summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/feeds.php50
-rw-r--r--schema/versions/pgsql/117.sql8
2 files changed, 40 insertions, 18 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index 07cc427a9..81729aacc 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -401,6 +401,37 @@ class Feeds extends Handler_Protected {
$entry_site_url = $line["site_url"];
+ //setting feed headline background color, needs to change text color based on dark/light
+ $fav_color = $line['favicon_avg_color'];
+
+ require_once "colors.php";
+
+ if ($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) 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%);";
+ "background-image : -webkit-gradient(linear, left top, right top, color-stop( 50%, rgba(255,255,255,0)),
+ color-stop(100%, rgba($rgba, 0.2)));"; */
+ } else {
+ $row_background = "";
+ }
+
if (!get_pref($this->link, 'COMBINED_DISPLAY_MODE')) {
if (get_pref($this->link, 'VFEED_GROUP_BY_FEED')) {
@@ -424,7 +455,7 @@ class Feeds extends Handler_Protected {
$mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
onmouseout='postMouseOut($id)'";
- $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs>";
+ $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs style='$row_background'>";
$reply['content'] .= "<div class='hlLeft'>";
@@ -530,23 +561,6 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div class=\"cdm $expanded_class $class\"
id=\"RROW-$id\" $mouseover_attrs'>";
- //setting feed headline background color, needs to change text color based on dark/light
- $fav_color = $line['favicon_avg_color'];
-
- require_once "colors.php";
-
- if ($fav_color) {
- if (!isset($rgba_cache[$feed_id]))
- $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
-
- $rgba = $rgba_cache[$feed_id];
-
- $row_background = "background-image : -moz-linear-gradient(left, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 95%";
-
- } else {
- $row_background = "";
- }
-
$reply['content'] .= "<div class=\"cdmHeader\" style=\"$row_background\">";
$reply['content'] .= "<div style=\"vertical-align : middle\">";
diff --git a/schema/versions/pgsql/117.sql b/schema/versions/pgsql/117.sql
new file mode 100644
index 000000000..da3d056cc
--- /dev/null
+++ b/schema/versions/pgsql/117.sql
@@ -0,0 +1,8 @@
+begin;
+
+ALTER TABLE ttrss_feeds ADD COLUMN favicon_avg_color VARCHAR(11);
+alter table ttrss_feeds alter column favicon_avg_color set default null;
+
+update ttrss_version set schema_version = 117;
+
+commit;