Bug 402115 - Choose the right color for the text when the panel is in the transparent mode
Summary: Choose the right color for the text when the panel is in the transparent mode
Status: RESOLVED FIXED
Alias: None
Product: lattedock
Classification: Unmaintained
Component: application (other bugs)
Version First Reported In: git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michail Vourlakos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-14 04:12 UTC by trmdi
Modified: 2018-12-26 07:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trmdi 2018-12-14 04:12:47 UTC
It can guess the right color in most cases, but sometimes it can't.
e.g. with these wallpaper, the color of content should be black instead of white:
+ https://alpha.wallhaven.cc/wallpaper/442858
+ https://alpha.wallhaven.cc/wallpaper/515193

Could you improve it a bit, or add an option to manually adjust the color when the panel in the transparent mode?
Comment 1 trmdi 2018-12-14 04:48:24 UTC
Something similar to this: https://trendct.org/2016/01/22/how-to-choose-a-label-color-to-contrast-with-background/

Not sure if latte has already used the similar way.
Comment 2 trmdi 2018-12-14 06:34:28 UTC
Another example shows that currently latte can't guess the best color.
See this screenshot: https://i.imgur.com/pOXhTYW.png
- Latte: white text color
- Trenct way (the link in #2): black -> better contrast
Comment 3 Michail Vourlakos 2018-12-14 17:30:16 UTC
(In reply to trmdi from comment #2)
> Another example shows that currently latte can't guess the best color.
> See this screenshot: https://i.imgur.com/pOXhTYW.png
> - Latte: white text color
> - Trenct way (the link in #2): black -> better contrast

Latte currently is using https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

that is also used by plasma in its lock screen implementation. Truth to be told I dont quite like it because it does not specify a threshold for what is considered bright and what it isnt. The proposed solution looks interesting I could try to support it.

By the way in one of your screenshots you used Plain Color for Desktop background this is not supported yet by the code. The code supports only background files. That does not mean you are not right, I confirmed this with : https://alpha.wallhaven.cc/wallpaper/515193

Steps to be done:
1. Open one new feature request for Latte to support also Plain Color
2. I will update the code parts to use brightness instead for luminas and see how it goes
3. Finish up the multi-screen aware code
Comment 4 trmdi 2018-12-15 02:56:30 UTC
(In reply to Michail Vourlakos from comment #3)
> 1. Open one new feature request for Latte to support also Plain Color

Done: https://bugs.kde.org/show_bug.cgi?id=402143
Comment 5 Michail Vourlakos 2018-12-25 18:22:37 UTC
Git commit b418923c0325f5259c675eab9da94b61cca9e8f3 by Michail Vourlakos.
Committed on 25/12/2018 at 18:20.
Pushed by mvourlakos into branch 'master'.

move from luminas to brightness

--the luminas functions didnt work well
for all cases. Latte is now using brightness
functions as described at:

   https://www.w3.org/TR/AERT/#color-contrast

this patch fixes all cases mentioned in the bug
that Latte contrast identification did not work well

M  +0    -1    app/CMakeLists.txt
D  +0    -434  app/settings/sortedactivitiesmodel.cpp
D  +0    -90   app/settings/sortedactivitiesmodel.h
M  +0    -58   app/settings/universalsettings.cpp
M  +0    -15   app/settings/universalsettings.h
M  +10   -0    containment/package/contents/code/ColorizerTools.js
M  +4    -32   containment/package/contents/ui/Ruler.qml
M  +7    -6    containment/package/contents/ui/colorizer/Manager.qml
M  +4    -4    liblatte2/backgroundtracker.cpp
M  +4    -4    liblatte2/backgroundtracker.h
M  +18   -0    liblatte2/commontools.cpp
M  +4    -0    liblatte2/commontools.h
M  +15   -15   liblatte2/plasma/extended/backgroundcache.cpp
M  +4    -4    liblatte2/plasma/extended/backgroundcache.h
M  +9    -0    plasmoid/package/contents/code/ColorizerTools.js
M  +2    -2    plasmoid/package/contents/ui/main.qml

https://commits.kde.org/latte-dock/b418923c0325f5259c675eab9da94b61cca9e8f3
Comment 6 trmdi 2018-12-26 02:58:09 UTC
I have 2 questions:

1. Latte only changes the text color if I choose the monochrome mode? If I choose ("hide background color for not maximized windows" + "no monochrome mode") the text color is the constant value from the theme.
I think Latte should always changes the text color when the panel background is hidden. No matter if the monochrome is On or Off.

2. In the monochrome mode, could Latte keep the original color of some applets like "Color picker" from the Latte side ?
Comment 7 Michail Vourlakos 2018-12-26 07:20:12 UTC
1. When the new settings reorganization lands the Dynamic Background options will be rethought, so open a new issue in order to discuss if this is needed
2. Latte will provide a way to disable colorizing at per applet basis but it can not paint selectively some parts of an applet. That is applet responsibility to support the new way of Latte painting just like Window applets are doing. For tracking the per-applet colorizing disabling you can open a different issue