[Feature request] Background quote color should be chameleon-like

Bug #1083683 reported by icb410
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Variety
New
Wishlist
Unassigned

Bug Description

Hi,

Love the new quote and clock features of variety! I would just make one request. Please make it possible for the quote background color to take on the average background color (desaturated a bit) so that on very colorful backgrounds it isn't so contrasting. Here's a bit of code I've used to do it:

    def get_color (self):
        """Code modified from Ambiance Chameleon - THANKS! """
        try:
            xprop_value = GLib.spawn_command_line_sync("/usr/bin/xprop -root _GNOME_BACKGROUND_REPRESENTATIVE_COLORS")
            rgb_set = re.match(r".*\((\d+)\,(\d+),(\d+).*", xprop_value[1]).groups ()
            color_hex = '%02x%02x%02x' % (int(rgb_set[0]), int(rgb_set[1]), int(rgb_set[2]))
            return [int(rgb_set[0]), int(rgb_set[1]), int(rgb_set[2])]
        except:
            dbg(self.debug,"No _GNOME_BACKGROUND_REPRESENTATIVE_COLORS xprop found... falling back to black background")
            return [0,0,0]

Then I set the background and font color like so (color scaling for my purposes is 0.5-0.7):

        self.BG_rgb= [int(i*COLOR_SCALING) for i in self.get_color() ]
        if sum(self.BG_rgb)/3 > 175:
            self.FONT_rgb=[0,0,0]
        else:
            self.FONT_rgb=[255,255,255]

Tags: wishlist
Revision history for this message
Peter Levi (peterlevi) wrote :

Quotes are drawn on the wallpaper image before it is set as a wallpaper, so I'll have to use another approach for calculating the color. When I have the time I'll play with this idea to see if I can get anything better than simply using dark gray as the backdrop (which is the current default and I think it works great for almost all images, except for very contrasting ones, where there is simply no good way to draw good looking text on top). The downside is this would be more CPU time for a relatively minor difference.

But this is definitely low priority for now - the quotes have already eaten quite a lot of time and they are not THAT central to Variety after all...

Changed in variety:
importance: Undecided → Wishlist
Revision history for this message
icb410 (ian-berke) wrote :

Thanks. understand that it's low priority and the current way it works is pretty good. Good news is you already have something in your code to get the average color of an image: AvgColor.py

Awesome work. I really do like the quotes. I also seem to be getting much better images from the feeds in the new version too.

Best,
Ian

Revision history for this message
Peter Levi (peterlevi) wrote :

Yes, AvgColor and DominantColors are both related to detecting the colors of an image. But you would be surprised how tricky it is to work with colors - the raw numbers that the machine sees are very differently representing the image from how a human actually interprets it. For example imagine a picture that has two equal parts of two opposite colors, like red and green. AvgColor would say it is gray. Any human would say it is definitely not gray and will probably add that an "average color" actually bears no meaning for this picture. I played a lot with this while trying to calibrate DominantColors for the color filtering option (and it is still far from perfect). So, what we would need instead of AvgColor would rather be to find the most dominant color in the area where the quote would be drawn. But as I said, this needs lots of playing around till it is calibrated and for now this effort definitely seems like an overkill for what we'll achieve with it.

> I also seem to be getting much better images from the feeds in the new version too
Pure luck :-) I sometimes get complete trash, sometime really nice images... The interesting part is that even if you visit those wallpaper sites in a browser and check their "most liked" images, it is again full of trash - it seems that simply users have way different tastes and what one finds great is trash for the other. I'm planning on a feature which will counter that, but I will reveal more details when I have given it some more serious thought.

Revision history for this message
Peter Levi (peterlevi) wrote :

In this line of thought, probably a more useful option would be one that would dynamically place the quote in that area of the image which has the least color variations, i.e. to find the "calm background" places of the image and place the quote there. But this is again lots of work and CPU cycles...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.