Adjust wallpaper accent calculation to increase contrast and vibrancy
Right now, the calculation prefers the image's dominant color, which is likely to be a color from the background. As a result, it often returns a color that is very dark or muted, especially with wallpapers based on night landscapes or space. The darkness is especially problematic when using a dark color scheme, where it causes contrast issues. It also has the effect of making the selection highlight on the desktop hard to see since by definition, its color will be very similar to the most common color in the wallpaper.
This commit adjusts the wallpaper accent color calculation as follows:
- Consider a narrower range of lightness values acceptable; now the lightness has to be at least 0.4, and it can't be darker than 0.75. This fixes most of the contrast issues.
- Try the wallpaper's highlight color before the dominant color. This tends to pick the color in the wallpaper that is most likely to draw the user's attention, even if it's not the most common color. It also tends to be a richer and brighter color compared to the dominant color, so the extracted accent color is more likly to be bright and pretty rather than dark and muted.
- If the highlight color or dominant color isn't within the specified lightness range, lighten or darken it and try again. This makes the algorithm work harder to try to give you a color based on the highlight color or the dominant color and avoid falling back to the average color, which is highly likely to return a drab, muted color.
BUG: 457861 FIXED-IN: 5.26
I could add a bunch of cherry-picked screenshots that show it working better for me, but in reality this is a rather subjective thing and you should test with your own wallpaper collection.