]> git.wh0rd.org Git - tt-rss.git/commitdiff
do not color predominantly white/black rows
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 15 Apr 2013 11:56:08 +0000 (15:56 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 15 Apr 2013 11:56:08 +0000 (15:56 +0400)
classes/feeds.php

index 79edca5d9adeb70a9937ddf99be9964ac17a9a5b..81729aacc60fa78571679e39aee2218203825154 100644 (file)
@@ -407,13 +407,22 @@ class Feeds extends Handler_Protected {
                                require_once "colors.php";
 
                                if ($fav_color) {
-                                       if (!isset($rgba_cache[$feed_id]))
-                                               $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
+                                       if (!isset($rgba_cache[$feed_id])) {
+                                               $hsl = rgb2hsl(_color_unpack($fav_color));
+
+                                               if ($hsl[1] < 0.1)
+                                                       $hsl[2] = 1;
+                                               else if ($hsl[2] < 0.25)
+                                                       $hsl[2] = 0.25;
+
+                                               $rgba_cache[$feed_id] = join(",", hsl2rgb($hsl));
+
+                                       }
 
                                        $rgba = $rgba_cache[$feed_id];
 
                                        // W3C definition seems to work in FF and Chrome
-                                       $row_background = "background-image : linear-gradient(to right, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 100%);";
+                                       $row_background = "background-image : linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba($rgba, 0.3) 100%);";
 
                                        /* $row_background = "background-image : -moz-linear-gradient(left, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 100%);".
                                                "background-image : linear-gradient(to right, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 100%);";