Commit 4a02c50
committed
Respect user light/dark preference when restoring nonexistent theme
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 #2440.1 parent a879598 commit 4a02c50
File tree
1 file changed
+23
-11
lines changed- bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme
1 file changed
+23
-11
lines changedLines changed: 23 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
596 | | - | |
597 | | - | |
| 596 | + | |
598 | 597 | | |
599 | 598 | | |
600 | 599 | | |
601 | 600 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | 601 | | |
608 | | - | |
609 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
610 | 622 | | |
611 | | - | |
| 623 | + | |
612 | 624 | | |
613 | 625 | | |
614 | 626 | | |
| |||
0 commit comments