Bug 576331 - Tab font is too light after switching OS theme from dark to light
Summary: Tab font is too light after switching OS theme from dark to light
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.21   Edit
Hardware: Macintosh All
: P3 normal (vote)
Target Milestone: 4.23 M3   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-29 13:14 EDT by Phil Beauvoir CLA
Modified: 2022-02-24 05:00 EST (History)
5 users (show)

See Also:


Attachments
Screenshot (621.19 KB, image/png)
2021-09-29 13:14 EDT, Phil Beauvoir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Beauvoir CLA 2021-09-29 13:14:01 EDT
Created attachment 287232 [details]
Screenshot

1. Set macOS system theme to Dark (System Preferences, General, Dark)
2. Launch Eclipse with a fresh workspace (so that there is no "org.eclipse.e4.ui.css.swt.theme.prefs" file)
3. Eclipse is set to its dark theme - this is correct.
4. Quit Eclipse
5. Set macOS system theme to Light (System Preferences, General, Light)
6. Launch Eclipse
7. Eclipse is set to its light theme, *but* the font color on the tabs is too light (see attached screenshot)

Seems that some things are written to "org.eclipse.ui.workbench.prefs" that are not set correctly:

org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=204,204,204
org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=41,41,41
org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=43,44,45
org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR=221,221,221
org.eclipse.ui.workbench.INACTIVE_TAB_BG_END=49,53,56
org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=59,64,66
org.eclipse.ui.workbench.INACTIVE_TAB_TEXT_COLOR=187,187,187
Comment 1 Alexis Drogoul CLA 2021-10-18 15:41:49 EDT
Exact same symptoms in an RCP app (see https://github.com/gama-platform/gama/issues/3193#issuecomment-937482279). Do you know which component writes these prefs ?
Comment 2 Phil Beauvoir CLA 2021-10-18 16:08:40 EDT
(In reply to Alexis Drogoul from comment #1)
> Exact same symptoms in an RCP app (see
> https://github.com/gama-platform/gama/issues/3193#issuecomment-937482279).
> Do you know which component writes these prefs ?

No, but I think it was a relatively recent change.

IMHO I think it was not a good idea.
Comment 3 Lakshmi P Shanmugam CLA 2022-01-26 12:23:48 EST
I see this problem as well, whenever I change the Mac system theme from Dark to Light.

The change in Bug 564488 causes the colors to be written in the org.eclipse.ui.workbench.prefs file.

The problem seems to be that ACTIVE_TAB_TEXT_COLOR=221,221,221 is written in the prefs file for dark theme. But, it's not changed for light theme. All the other colors are changed accordingly for light and dark theme.

I'm not sure why ACTIVE_TAB_TEXT_COLOR is not updated for light theme or where to fix this exactly.
Comment 4 Mickael Istria CLA 2022-01-27 09:02:26 EST
> I'm not sure why ACTIVE_TAB_TEXT_COLOR is not updated for light theme or
> where to fix this exactly.

Dark theme sets the value for this color preference:
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n42 and https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n166
Light theme doesn't set anything about it https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.themes/css/light/e4-light_ide_colorextensions.css#n23 , so setting the light theme doesn't change the color value, which sticks to earlier value, from dark theme here.
A solution would be to make the light theme explicitly set a value for this preference similarly to how dark theme does it.
Comment 5 Thomas Wolf CLA 2022-01-27 09:20:13 EST
(In reply to Mickael Istria from comment #4)
> > I'm not sure why ACTIVE_TAB_TEXT_COLOR is not updated for light theme or
> > where to fix this exactly.
> 
> Dark theme sets the value for this color preference:
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n42 and
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n166
> Light theme doesn't set anything about it
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/light/e4-light_ide_colorextensions.css#n23 , so
> setting the light theme doesn't change the color value, which sticks to
> earlier value, from dark theme here.
> A solution would be to make the light theme explicitly set a value for this
> preference similarly to how dark theme does it.

I noticed that, too. But what about all the other colors for which the dark theme provides values and the light and system theme don't? Do they show the same behavior of not resetting on a switch from dark to light?
Comment 6 Phil Beauvoir CLA 2022-01-27 09:22:28 EST
Is the change in Bug #564488 necessary? It seems to be a strange way to handle this.
Comment 7 Mickael Istria CLA 2022-01-27 09:37:22 EST
(In reply to Thomas Wolf from comment #5)
> I noticed that, too. But what about all the other colors for which the dark
> theme provides values and the light and system theme don't? Do they show the
> same behavior of not resetting on a switch from dark to light?

Note that light theme != system theme; system theme uses system colors (though SWT symbols), light theme hardcodes some specific colors.
But yes, this is in general true that if theme doesn't set a color, then it stays on the same value as it was before the switch, because there is basically no better value to guess.

(In reply to Phil Beauvoir from comment #6)
> Is the change in Bug #564488 necessary? It seems to be a strange way to
> handle this.

IIRC, without this change, it was very probable that when switching themes, the color shown in the preference page where not matching the colors in the editor/ColorRegistry.
It seems important to keep both preferences and ColorRegistry sync'd for such reason. I don't think it's a bug per se, but it does reveal some other bugs in themes themselves not fully defining their palette.
Comment 8 Eclipse Genie CLA 2022-01-28 06:26:24 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/190110
Comment 9 Lakshmi P Shanmugam CLA 2022-01-28 06:34:04 EST
(In reply to Mickael Istria from comment #4)
> > I'm not sure why ACTIVE_TAB_TEXT_COLOR is not updated for light theme or
> > where to fix this exactly.
> 
> Dark theme sets the value for this color preference:
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n42 and
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n166
> Light theme doesn't set anything about it
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> eclipse.ui.themes/css/light/e4-light_ide_colorextensions.css#n23 , so
> setting the light theme doesn't change the color value, which sticks to
> earlier value, from dark theme here.
> A solution would be to make the light theme explicitly set a value for this
> preference similarly to how dark theme does it.

Thanks Mickael for the pointers.
I created a patch with the change and the problem seems to be fixed in Eclipse UI. But, I see that the ACTIVE_TAB_TEXT_COLOR no longer appears in the prefs file when Eclipse is in light theme. It appears only when switched to dark theme.
Comment 10 Lakshmi P Shanmugam CLA 2022-01-28 06:36:04 EST
(In reply to Thomas Wolf from comment #5)
> (In reply to Mickael Istria from comment #4)
> > > I'm not sure why ACTIVE_TAB_TEXT_COLOR is not updated for light theme or
> > > where to fix this exactly.
> > 
> > Dark theme sets the value for this color preference:
> > https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> > eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n42 and
> > https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> > eclipse.ui.themes/css/dark/e4-dark_ide_colorextensions.css#n166
> > Light theme doesn't set anything about it
> > https://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.
> > eclipse.ui.themes/css/light/e4-light_ide_colorextensions.css#n23 , so
> > setting the light theme doesn't change the color value, which sticks to
> > earlier value, from dark theme here.
> > A solution would be to make the light theme explicitly set a value for this
> > preference similarly to how dark theme does it.
> 
> I noticed that, too. But what about all the other colors for which the dark
> theme provides values and the light and system theme don't? Do they show the
> same behavior of not resetting on a switch from dark to light?

In my testing, I see that only the 7 colors in the comment#0 are written to the prefs file when in dark theme, others are not saved to the file. Not sure why.
Comment 11 Lakshmi P Shanmugam CLA 2022-01-28 06:41:48 EST
Also from a quick test, bug doesn't seem to happen on Windows. Couldn't test on Linux.
Comment 12 Phil Beauvoir CLA 2022-01-28 07:38:42 EST
(In reply to Lakshmi P Shanmugam from comment #11)
> Also from a quick test, bug doesn't seem to happen on Windows. Couldn't test
> on Linux.

Juts tested on Linux and Windows and the bug occurs there as well.
Comment 13 Lakshmi P Shanmugam CLA 2022-01-28 08:15:30 EST
(In reply to Phil Beauvoir from comment #12)
> (In reply to Lakshmi P Shanmugam from comment #11)
> > Also from a quick test, bug doesn't seem to happen on Windows. Couldn't test
> > on Linux.
> 
> Juts tested on Linux and Windows and the bug occurs there as well.

Thanks for checking, Phil!
Comment 14 Lakshmi P Shanmugam CLA 2022-02-02 07:14:11 EST
@All, The patch fixes the problem, but ACTIVE_TAB_TEXT_COLOR is still not set in the prefs file. Not sure why or if it's a problem.
Please suggest, does the patch looks good or should I revert the original change instead?
Comment 15 Mickael Istria CLA 2022-02-07 08:44:00 EST
(In reply to Lakshmi P Shanmugam from comment #14)
> @All, The patch fixes the problem, but ACTIVE_TAB_TEXT_COLOR is still not
> set in the prefs file. Not sure why or if it's a problem.

Does it cause any further bug? It could be that the ACTIVE_TAB_TEXT_COLOR is back to the default preference value and is then "unset".

> Please suggest, does the patch looks good or should I revert the original
> change instead?

I think the original change was interesting and useful, and as discussed in comment 7, I believe it was actually fixing a bug by the way with some colors being wrong on preference pages.
So if the proposed patch fixes the issue reported here, I don't think we should revert the former one.
Comment 16 Lakshmi P Shanmugam CLA 2022-02-10 06:00:59 EST
(In reply to Mickael Istria from comment #15)
> (In reply to Lakshmi P Shanmugam from comment #14)
> > @All, The patch fixes the problem, but ACTIVE_TAB_TEXT_COLOR is still not
> > set in the prefs file. Not sure why or if it's a problem.
> 
> Does it cause any further bug? It could be that the ACTIVE_TAB_TEXT_COLOR is
> back to the default preference value and is then "unset".
> 
I tested on Mac with child eclipse and didn't notice any other issues.

> 
> I think the original change was interesting and useful, and as discussed in
> comment 7, I believe it was actually fixing a bug by the way with some
> colors being wrong on preference pages.
> So if the proposed patch fixes the issue reported here, I don't think we
> should revert the former one.
Ok, let's try this fix.
Comment 18 Lakshmi P Shanmugam CLA 2022-02-11 06:46:35 EST
Fixed in I20220210-1800.
Comment 19 Lakshmi P Shanmugam CLA 2022-02-24 05:00:00 EST
Verified in I20220223-1800