[Rt-commit] rt branch, custom-css, updated. rt-3.8.8-530-g1693ebb

Chia-liang Kao clkao at bestpractical.com
Tue Aug 24 13:53:56 EDT 2010


The branch, custom-css has been updated
       via  1693ebba0847e555c1c1d5157862c3a282ad1166 (commit)
      from  2629406a6710732ba37cd30a3aa761e329697518 (commit)

Summary of changes:
 share/html/Admin/Global/Theme.html |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 1693ebba0847e555c1c1d5157862c3a282ad1166
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:56:19 2010 +0800

    use Convert::Color instead

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index ed3165a..42b7cd5 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -147,7 +147,7 @@ jQuery(function($) {
 my @results;
 
 use Imager;
-use Graphics::Color::RGB;
+use Convert::Color;
 
 my $img = Imager->new;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
@@ -207,12 +207,11 @@ sub analyze_img {
     for my $i (0..$img->getwidth-1) {
         for my $j (0..$img->getheight-1) {
             my @color = $img->getpixel(x=>$i, y=>$j)->rgba;
-            my $hsl = Graphics::Color::RGB->new( red => $color[0] / 255, green => $color[2] / 255, blue => $color[2] / 255, alpha => $color[3] / 255 )->to_hsl;
-            my ($h,$s,$l) = $hsl->as_array;
             pop @color;
+            my $hsl = Convert::Color->new('rgb:'.join(',',map { $_ / 255 } @color))->convert_to('hsl');
             my $c = join(',', at color);
-            next if $l < 0.1;
-            $color->{$c} ||= { h => $h, s => $s, l => $l, cnt => 0, c => $c};
+            next if $hsl->lightness < 0.1;
+            $color->{$c} ||= { h => $hsl->hue, s => $hsl->saturation, l => $hsl->lightness, cnt => 0, c => $c};
             $color->{$c}->{cnt}++;
         }
     }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list