summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-01-12 03:14:58 +0100
committerJavier S. Pedro <maemo@javispedro.com>2012-01-12 03:14:58 +0100
commitf11d9d82acc9ff8bc6eec178ad2527ee89462793 (patch)
treed3a6cee0a4268d67103856de54bf2dc9e86fea1d /index.php
parentb5cb88aa92eb4eaac06afebe5109b0beac8f5ea8 (diff)
downloadhicg-f11d9d82acc9ff8bc6eec178ad2527ee89462793.tar.gz
hicg-f11d9d82acc9ff8bc6eec178ad2527ee89462793.zip
properly round color components
Diffstat (limited to 'index.php')
-rw-r--r--index.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/index.php b/index.php
index 4fff92d..889d91d 100644
--- a/index.php
+++ b/index.php
@@ -174,9 +174,10 @@ function extract_dominant_color($svg, $algo = 'average', $filter = 'grey')
function clip_color_value($c)
{
- if ($c < 0) return 0;
- else if ($c > 255) return 255;
- return $c;
+ $i = intval(round($c));
+ if ($i < 0) return 0;
+ else if ($i > 255) return 255;
+ return $i;
}
function clip_color($c)