summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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>, ";
}
}