Bug 308802

Summary: the telepathy contact list has wrong colors, resulting in white-on-white text
Product: [Frameworks and Libraries] telepathy Reporter: Philipp A. <flying-sheep>
Component: contactlistAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: cfeck, kde, mklapetek, rohan
Priority: NOR    
Version: 0.5.1   
Target Milestone: Future   
Platform: Arch Linux   
OS: Linux   
URL: http://imgur.com/CHbzu
Latest Commit: Version Fixed In: 0.5.2
Attachments: The Colours Dialog in KDE

Description Philipp A. 2012-10-22 11:09:46 UTC
in the screenshot, no text should be white or black, but instead a darker version of the respective background color (dark yellow on yellow, dark green on green, dark blue on blue, dark purple on purple)

please start using the check color roles color scheme to spot errors in the color role assignment.
http://kde-look.org/content/show.php?action=content&content=90034

Reproducible: Always
Comment 1 Philipp A. 2012-10-22 11:13:23 UTC
in this particular case, we have 3 (!) different wrong colors on the same background.

the expansion arrow is dark blue instead of dark green, the line next to it is black instead of dark green, and the text is white instead of dark green.
Comment 2 David Edmundson 2012-10-22 17:41:49 UTC
Thanks for that kde-look link.

I think this bug might be misleading.

Upon code inspection there _is_ a bug that the contact list won't handle changes to the style immediately.
(now opened a new bug at https://bugs.kde.org/show_bug.cgi?id=308820 about that issue)

Upon restarting the contact list after changing the colour scheme, the colours are all appeared correct to me. Could you confirm?
Comment 3 Rohan Garg 2012-10-22 17:44:14 UTC
I can confirm the colors are fine once you restart the contactlist
Comment 4 Martin Klapetek 2012-10-23 12:18:37 UTC
Git commit d57901ab55947c1f3bae152c7d30bd6704b056b7 by Martin Klapetek.
Committed on 23/10/2012 at 14:14.
Pushed by mklapetek into branch 'master'.

Use option's palette instead of storing app's palette in class var

Reviewed-by: Rohan Garg
REVIEW: 107008
Related: bug 308820

M  +4    -6    abstract-contact-delegate.cpp
M  +0    -1    abstract-contact-delegate.h
M  +4    -4    contact-delegate-compact.cpp
M  +4    -4    contact-delegate.cpp

http://commits.kde.org/telepathy-contact-list/d57901ab55947c1f3bae152c7d30bd6704b056b7
Comment 5 Philipp A. 2012-10-23 14:57:43 UTC
ok, that was another bug and indeed my screenshot was misleading.

but contrary to what david and rohan said, even after a restart, the color roles are still wrong. after restarting, it’s still purple/blue on green instead of green on green:

http://imgur.com/JglwO

listen closely: what’s happening here is that one widget type widget using the button color role (purple, the line) and three types using the windows color role (blue, group text, 
contact text, and group expansion arrow) are rendered with transparent backgrounds on top of a widget with the view color role (green, the contact list background).

so basically we forget to set the arrows’, labels’, and lines’ color-role to “view”, when we set their background to be transparent.

————————

this bug will be only fixed once no background has another basic color (blue, yellow, green, purple) than a widget drawn over it.
Comment 6 Philipp A. 2012-10-23 15:01:49 UTC
note that the selected entry has the right text color, but still the wrong arrow/line colors, so we need to take care of that, too, when selecting stuff.

that one is fixed as soon as above screenshot can be replicated with everything in the green area being green, except (the icons and) the yellow area, in which everything has to be yellow.
Comment 7 David Edmundson 2012-10-23 16:09:57 UTC
That was really confusing.

Are there any other tree views that you consider "correct" ?

I'll make a list of all the items and what roles they are currently using, you can tell me what they should be using.

Selected name text:
   QPalette::Active, QPalette::HighlightedText
Normal name text:
   QPalette::Active, QPalette::WindowText
Selected presence message text:
   QPalette::Disabled, QPalette::HighlightedText
normal presence message text:
   QPalette::Disabled, QPalette::WindowText
The line:
   QPalette::Inactive, QPalette::Button;
Group Arrows:
   using QStyle::drawPrimitive() so definitely right

Ideally please use names from:
http://doc.qt.digia.com/4.5/qpalette.html#ColorGroup-enum 
and http://doc.qt.digia.com/4.5/qpalette.html#ColorRole-enum

so we're all talking the same language.
Comment 8 Martin Klapetek 2012-10-23 17:03:30 UTC
Fwiw, there's a patch changing the group headers completely, can you perhaps try it out? 

https://git.reviewboard.kde.org/r/106763/
Comment 9 Christoph Feck 2012-10-24 00:08:48 UTC
> tell me what they should be using

When using QPalette, only the following combinations are allowed (Fg on Bg):

    WindowText on Window (window surface, usually black on gray)
    Text on Base (input fields, usually black on white)
    Text on AlternateBase (for alternating row coloring, usually black on light gray)
    HighlightedText on Highlight (selections, usually white on blue)
    ButtonText on Button (usually black on gray)
    ToolTipText on ToolTipBase (usually black on yellow)

Some more foreground colors exists (BrightText, Link, LinkVisited), but since it is unclear to which background they apply, you should not use them.

Additionally, be careful when mixing different color groups (Disabled, Active, Inactive). You cannot assume that a Disabled foreground is visible on an Active background color, for example. If in doubt, use reduced alpha for less important items, instead of possibly using an unreadable combination.

If you need more control for color combinations, use KColorScheme.
Comment 10 David Edmundson 2012-10-24 02:22:12 UTC
I'm not convinced that changing opacity is a suitable workaround. I've had to fix stuff in Plasma where there were different levels of opacity being used. Thus resulting in 50 shades of grey.

Also grey and black at 50% transparency aren't the same thing, the background should not be showing through the end pixel result is a different colour depending on what it's on - which is wrong. It's a bad hacky workaround at best.

We can maybe use Active::Inactive text for the less important text.
Comment 11 Philipp A. 2012-10-25 16:19:09 UTC
all of that is really not as important as ensuring what i and comment #7 say:

1.  each color role has a background color, and no foreground color from one role should appear on top of the background color of another

2. this is easily assessed by using abobe linked color scheme

i don’t get how that could possibly confuse anyone :)
Comment 12 David Edmundson 2012-10-26 06:29:59 UTC
I am still waiting on an explicit list of all items which are wrong as requested earlier.

As far as I can tell, all text is correct. 

Only other item is we use the button background on the view, but it's perfectly OK to embed buttons in a view (see KPluginLoader or Get New Stuff), so I consider that perfectly OK to do.
Comment 13 Christoph Feck 2012-10-26 09:50:49 UTC
Looking at the screen shot from comment #5, also the text has wrong color, which the most serious issue, because it can easily lead to unreadable text with special color schemes.

Also, it is certainly OK to use buttons within item views. But unless they also use the Button background, they should not be rendered using ButtonText.
Comment 14 Martin Klapetek 2012-10-26 09:53:42 UTC
> Looking at the screen shot from comment #5, also the text has wrong color

Which text are you referring to? The main text for names is a standard colors text (I think at least), it uses QPalette::Active, QPalette::WindowText. What's wrong with that?
Comment 15 David Edmundson 2012-10-26 09:59:44 UTC
Created attachment 74807 [details]
The Colours Dialog in KDE

I don't see how the text colours are wrong.

Attached is a screenshot of the theme selection dialog in KDE. I think it's safe to assume the colour selection dialog would using the right roles. To me this looks the same.
Comment 16 David Edmundson 2012-10-26 10:01:52 UTC
> Also, it is certainly OK to use buttons within item views. But unless they
> also use the Button background, they should not be rendered using ButtonText.

We are rendering button background onto the view, nothing uses button text.
Comment 17 Martin Klapetek 2012-10-26 10:05:10 UTC
....and that is the line, which I'm trying to get rid of completely.

/me points again to https://git.reviewboard.kde.org/r/106763/
Comment 18 David Edmundson 2012-10-26 10:05:32 UTC
 
> Attached is a screenshot of the theme selection dialog in KDE. I think it's
> safe to assume the colour selection dialog would using the right roles. To
> me this looks the same.

Oh, it's the normal text that's apparently wrong. not the highlight.

I finally understand.
Comment 19 Martin Klapetek 2012-10-26 10:11:08 UTC
Me too.

And I'll answer myself - QPalette::WindowText is the widget background, not the view background, which seems to be QPalette::Base.
Comment 20 Martin Klapetek 2012-10-26 10:13:55 UTC
Erm, got confused a bit apparently :D QPalette::WindowText is text on widgets and we should be using QPalette::Text, which is to be used with QPalette::Base, which is background for views.
Comment 21 David Edmundson 2012-10-26 11:18:49 UTC
Git commit 0cd69ab53ecc4189a0827b7a80b1bba884197f2b by David Edmundson.
Committed on 26/10/2012 at 13:16.
Pushed by davidedmundson into branch 'kde-telepathy-0.5'.

Use correct colour role when painting text delegates on a view

REVIEWED-BY: Martin Klapetek
FIXED-IN: 0.5.2

M  +1    -1    abstract-contact-delegate.cpp
M  +2    -2    contact-delegate-compact.cpp
M  +2    -2    contact-delegate.cpp

http://commits.kde.org/telepathy-contact-list/0cd69ab53ecc4189a0827b7a80b1bba884197f2b
Comment 22 Philipp A. 2012-10-29 20:27:26 UTC
looks good!

note also that the lines between text and arrow in this screenshot are pink: http://imgur.com/JglwO

that’s also wrong: it is seemingly drawn with the ButtonText colorrole
Comment 23 Martin Klapetek 2012-10-29 20:30:25 UTC
For the third time I'd like to point you to https://git.reviewboard.kde.org/r/106763/

Those lines are going to be removed, just don't mind them.
Comment 24 Philipp A. 2012-10-29 20:57:40 UTC
(In reply to comment #23)
> For the third time I'd like to point you to
> https://git.reviewboard.kde.org/r/106763/
> 
> Those lines are going to be removed, just don't mind them.

oh, sorry, i misinterpretted it – awesome that it’s restructured.