summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-03-29 08:57:49 +0100
committerAndreas Unterkircher <unki@netshadow.at>2008-03-29 09:18:40 +0100
commit67f0eb35f6c3fe9bdda3cb585a0fe5e9ccb0e563 (patch)
treed230b68a6ab6db9ca4877fe0849c6cc93e49efad
parentef48f1930daad7ffc993708ff9e6656135897964 (diff)
issue108, a bit more color for tag-cloud
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
-rw-r--r--CHANGELOG1
-rw-r--r--phpfspot.class.php13
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9cf51cb..e226e78 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@ phpfspot (1.4)
* feature, support PNG image format.
* feature, auto-completion for tag-search.
* feature, lightbox2 for photo preview out of the photo index.
+ * feature, a bit more color for tag-cloud.
* bug, SQlite temporary directory can now be set in phpfspot_cfg.php
-- Andreas Unterkircher <unki@netshadow.at> Sat, 29 Mar 2008 11:00:00 +0100
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 7cc4e19..be752ee 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -586,6 +586,10 @@ class PHPFSPOT {
$max_size = 125; // max font size in %
$min_size = 75; // min font size in %
+ // color
+ $max_sat = hexdec('cc');
+ $min_sat = hexdec('44');
+
// get the largest and smallest array values
$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));
@@ -599,6 +603,7 @@ class PHPFSPOT {
// determine the font-size increment
// this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);
+ $step_sat = ($max_sat - $min_sat)/($spread);
// loop through our tag array
foreach ($tags as $key => $value) {
@@ -614,8 +619,14 @@ class PHPFSPOT {
// uncomment if you want sizes in whole %:
$size = ceil($size);
+ $color = $min_sat + ($value - $min_qty) * $step_sat;
+
+ $r = '44';
+ $g = dechex($color);
+ $b = '88';
+
if(isset($this->tags[$key])) {
- $output.= "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%;\">". $this->tags[$key] ."</a>, ";
+ $output.= "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
}
}