Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid and tabs on rasberry pi and other unix platforms with dark themes is unreadable #18941

Closed
wxtrac opened this issue Oct 13, 2020 · 18 comments
Closed

Comments

@wxtrac
Copy link
Collaborator

@wxtrac wxtrac commented Oct 13, 2020

Issue migrated from trac ticket # 18941

component: GUI-all | priority: normal | resolution: fixed | keywords: regression

2020-10-13 03:16:52: mgrouch created the issue


Uses white fonts over white backgrounds

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 13, 2020

2020-10-13 03:46:20: mgrouch commented


And BTW tabs are drawing with black font on black background too.
Not readable

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 13, 2020

2020-10-13 03:46:51: mgrouch commented


And BTW tabs are drawing with black font on black background too.
Not readable

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 13, 2020

2020-10-13 03:55:51: mgrouch commented


Maybe choosing the font color should be based on the background of the theme
automatically?

Here is more info on RGB luminance

https://en.wikipedia.org/wiki/Grayscale

might be the font needs to invert it given color of background automatically?

It either needs to trust background color of the theme or foreground.

I think the whole theme colors can't be trusted cause user might have set
them anyway improper.

Might be do automatic optimization so it even always shows up fine on print outs in grayscale. It might use background color as a base and foreground as a hint for optimization
And it should take

into consideration that some people are color blind too.
Thanks

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 13, 2020

2020-10-13 18:43:34: @vadz commented


Could you please tell which theme are you using?

Also, there are some changes improving the matters for the dark mode under macOS, but they're not perfect, so this still needs to be improved.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 13, 2020

2020-10-13 19:54:24: mgrouch commented


sudo apt install breeze-gtk-theme breeze-icon-theme breeze-icon-theme breeze-icon-theme-rcc breeze-cursor-theme

lxappearance

Change theme to 'Breeze-Dark'

Grids with selections
and multi-tabs are the issues.

White on white in grids
and dark on dark in tabs

Thanks

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 14, 2020

2020-10-14 19:18:24: @dkulp commented


Grid has tons on color issues with dark mode on OSX as well. The patch I use for my application is:

dkulp@e76a860

which was submitted as part of another PR but was never applied. You could give it a try.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 14, 2020

2020-10-14 19:36:38: mgrouch commented


The patch looks sane.
Why wasn't it applied into wxWidgets master?

Thanks

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 15, 2020

2020-10-15 19:00:19: @vadz commented


This is the patch which I mentioned in comment:6. It wasn't applied because it still doesn't work under Linux (not sure if it makes things worse, but they're definitely not right with this change) and I hope to fix them there too.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 15, 2020

2020-10-15 19:26:18: mgrouch commented


BTW tabs are also an issue in dark theme

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 19, 2020

2020-10-19 23:41:53: mgrouch changed priority from normal to high

2020-10-19 23:41:53: mgrouch changed title from Grid on rasberry pi with dark themes is unreadable to Grid and tabs on rasberry pi and other unix platforms with dark themes is unreadable

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 19, 2020

2020-10-19 23:44:20: @vadz changed priority from high to normal

2020-10-19 23:44:20: @vadz commented

Please don't change the priority, this doesn't help at all with fixing the bug faster.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Oct 20, 2020

2020-10-20 03:25:52: mgrouch commented


It is possible that application doing something wrong.
I think it changes background for cells, but they test it only in
light or default light color theme.
The issue I see is that in some cases rows have very light color in
white background, and tab headers have dark font color with dark background.

As a first attempt what if we before rendering text in these two
problematic areas (grid cells and tabs headers)
somehow measure distance between font color and background color.

If they are too close we will only change font color to something readable,
leaving background color as is. And in that case we pick a font color from grey scale.
(so either close to white, or closer to black depending on the brightness in grey scale
of the background).

I'll lookup formulas for RGB conversion to grays cale.
It's a single number 0-255 let's say b for background .
Font color in grey scale will give another 0-255 number (say f).

grayscale image = ( (0.3 * R) + (0.59 * G) + (0.11 * B) ).

(assuming r,g,b are in range of 0 to 255)

If (abs(b-f) < 128
then {
   use gray scale color for font with brightness n=(255-f)

   grey scale value back into RGB https://stackoverflow.com/questions/835753/convert-grayscale-value-to-rgb-representation
  
   (R, G, B) = (n/3, n/3, n/3)

}

And add a flag to turn off this logic. On Grid and Tabs.
But flag should be 'on' by default because there are lots of applications having this issue
currently. I've seen it a lot on raspberry pi (where default theme is light colored)

Just an idea.

Thanks,
--MG

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Jan 18, 2021

2021-01-18 00:11:26: @vadz changed status from new to infoneeded_new

2021-01-18 00:11:26: @vadz commented

Please check if you still see any serious issues with the latest master, after the commit referenced below, and explain/show what exactly are they, so that we could fix them. TIA!

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Jan 18, 2021

2021-01-18 00:11:39: @vadz commented


In 3c28244:
Improve wxGrid appearance in dark mode under macOS

Use more appropriate colours for the row/column cell headers and don't
hardcode black (i.e. at least use white instead in dark mode) for the
frozen border.

Closes #2026

See #18941.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented Feb 11, 2021

2021-02-11 21:36:01: @discnl changed status from infoneeded_new to new

2021-02-11 21:36:01: @discnl commented

As hinted at, under MSW the highlight is pretty much invisible now.

Both the referred to wxSYS_COLOUR_WINDOWTEXT and wxSYS_COLOUR_LISTBOXTEXT do work and are black in light mode and white in dark mode.
RGB values were checked under Win XP and 10 (using high contrast for dark modes), macOS 10.13 (no dark mode available) and 11.0.

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented May 19, 2021

2021-05-19 19:42:59: @vadz changed component from wxGTK to GUI-all

2021-05-19 19:42:59: @vadz commented

Replying to [comment:8 dkulp]:

Grid has tons on color issues with dark mode on OSX as well. The patch I use for my application is:

dkulp@e76a860

which was submitted as part of another PR but was never applied.

FWIW, the reason it wasn't applied was because I was not sure it wasn't going to break something under the other platforms and I was wrong to apply it without testing it myself because it did totally break wxMSW, see #19179 (also mentioned in the comment:17 but I didn't realize just how bad it was).

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented May 22, 2021

2021-05-22 17:19:03: @vadz changed status from new to accepted

2021-05-22 17:19:03: @vadz commented

I've finally created PR 2378 fixing this and tweaking a couple of other things. Please let me know if anybody sees any problems with this, TIA!

@wxtrac
Copy link
Collaborator Author

@wxtrac wxtrac commented May 31, 2021

2021-05-31 17:04:30: @vadz changed status from accepted to closed

2021-05-31 17:04:30: @vadz set resolution to fixed

2021-05-31 17:04:30: @vadz commented

In 82ebbe8:
Merge branch 'grid-colours'

Fix colours of wxGrid cursor after a recent regression.

See #2378

Closes #18941.

@wxtrac wxtrac closed this May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant