Skip to content

Conversation

@sratz
Copy link
Member

@sratz sratz commented Feb 13, 2025

When restoring a theme from preferences, which does not exist anymore. we previously fell back to inherting from the operating system.

However, when when the user actively set the Eclipse theme to not match the light/dark mode of the OS, we would then fall back again to inheritance and override the user's choice.

To improve this, we look at the preference the user had actively chosen before and see whether that was a dark theme or not and decide on that which theme to fall back to.

Note: To check whether the theme is light or dark, we use the same heuristic also used in other places, themeId.contains("dark"):

  • org.eclipse.e4.ui.swt.internal.gtk.DarkThemeProcessor
  • org.eclipse.e4.ui.swt.internal.win32.DarkThemeProcessor
  • org.eclipse.e4.ui.swt.internal.cocoa.CocoaDarkThemeProcessor

Future improvements to consider, out of scope for this change:

Resolves: #2776
Closes: #2273

When restoring a theme from preferences, which does not exist anymore.
we previously fell back to inherting from the operating system.

However, when when the user actively set the Eclipse theme to not match
the light/dark mode of the OS, we would then fall back again to
inheritance and override the user's choice.

To improve this, we look at the preference the user had actively chosen
before and see whether that was a dark theme or not and decide on that
which theme to fall back to.

Note: To check whether the theme is light or dark, we use the same
heuristic also used in other places, themeId.contains("dark"):
- org.eclipse.e4.ui.swt.internal.gtk.DarkThemeProcessor
- org.eclipse.e4.ui.swt.internal.win32.DarkThemeProcessor
- org.eclipse.e4.ui.swt.internal.cocoa.CocoaDarkThemeProcessor

Future improvements to consider, out of scope for this change:
- Move the heuristic themeId.contains("dark") to central place
  and to re-use
- Even better, add an explicit "isDark" flag / preference somewhere
- On top of that, use a mode=dark/light/followSystem instead, see
  also eclipse-platform#2440.
@sratz sratz requested a review from BeckerWdf February 13, 2025 12:58
@github-actions
Copy link
Contributor

Test Results

 1 818 files  + 1 818   1 818 suites  +1 818   1h 30m 13s ⏱️ + 1h 30m 13s
 7 721 tests + 7 721   7 493 ✅ + 7 493  228 💤 +228  0 ❌ ±0 
24 324 runs  +24 324  23 575 ✅ +23 575  749 💤 +749  0 ❌ ±0 

Results for commit 4a02c50. ± Comparison against base commit a879598.

@sratz sratz added this to the 4.35 M3 milestone Feb 13, 2025
@sratz sratz merged commit 4e127ef into eclipse-platform:master Feb 13, 2025
17 checks passed
@sratz sratz deleted the theme-restore-darklight branch February 13, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

modern light theme selected gets switched back to dark when upgrading

2 participants