Skip to content

Let themes declare that they are dark - #4354

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:vogella/theme-dark-attribute
Sep 10, 2026
Merged

vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:vogella/theme-dark-attribute

Conversation

@vogella

@vogella vogella commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Themes can now declare their appearance with an isDarkTheme attribute on the theme extension point instead of the platform guessing it from the theme id. Themes that do not set it keep the old id based classification, so existing contributions behave as before.

ITheme.isDark() is added as a default method, so implementors are not broken. The theme engine uses it for the SWT appearance preference and when picking a dark theme to inherit the operating system setting, which means a product shipping its own dark theme is now handled instead of only org.eclipse.e4.ui.css.theme.e4_dark. The appearance preference page only recommends a restart when the switch actually crosses between light and dark, so switching between two dark themes no longer interrupts with a dialog. The flag is persisted next to the theme id, which lets IDEApplication style the workspace selection dialog from the recorded value, the only thing it has before the workbench and the theme engine exist.

This supersedes #2808 by @BeckerWdf, which had the same idea and where the isDarkTheme attribute name comes from. That PR no longer applies since the platform specific dark theme processors it patches have been removed in the meantime.

@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   858 files  +  286     858 suites  +286   55m 18s ⏱️ + 3m 11s
 8 311 tests +    3   8 068 ✅ +    8  243 💤  -   5  0 ❌ ±0 
20 802 runs  +6 940  20 132 ✅ +6 725  670 💤 +215  0 ❌ ±0 

Results for commit b863876. ± Comparison against base commit ee7ae1f.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new defaults regress legacy ID-based dark-theme behavior for existing ITheme implementations and two-argument Theme construction.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds explicit dark-theme metadata while retaining legacy ID-based detection and persisting appearance information for early startup styling.

Changes:

  • Adds isDarkTheme extension metadata and ITheme.isDark().
  • Uses and persists appearance metadata throughout theme selection.
  • Avoids restart prompts when switching between themes of the same appearance.
File summaries
File Description
ThemeTest.java Tests metadata parsing and persistence.
plugin.xml (tests) Declares test themes.
css/testTheme.css Supplies test stylesheet.
build.properties Packages test resources.
DefaultThemePreference.java Centralizes default-theme persistence.
ViewsPreferencePage.java Uses appearance-aware restart behavior.
org.eclipse.ui.themes/plugin.xml Marks platform dark themes explicitly.
IDEApplication.java Reads persisted appearance during startup.
ITheme.java Adds the appearance API.
ThemeEngine.java Parses, applies, persists, and restores appearance.
Theme.java Stores explicit appearance state.
org.eclipse.e4.ui.css.swt.theme.exsd Documents the extension attribute.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vogella
vogella force-pushed the vogella/theme-dark-attribute branch 2 times, most recently from 445499d to ffbd198 Compare September 8, 2026 16:29
@vogella
vogella force-pushed the vogella/theme-dark-attribute branch from ffbd198 to 5cd65b6 Compare September 9, 2026 11:31
@vogella

vogella commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

PR updated with the proposals, except one which was IMHO just a misunderstanding caused by wrong Javadoc, fixed now.

The theme extension point gains an "isDarkTheme" attribute, so a theme states
its appearance instead of the platform guessing it from the theme id. Themes
without the attribute keep the id based classification.

ThemeEngine uses ITheme.isDark() for the SWT appearance preference and when
picking a dark theme to inherit the operating system setting, so a product
shipping its own dark theme works too. The appearance preferences recommend a
restart only when switching between light and dark. The flag is persisted next
to the theme id, which lets IDEApplication style the workspace selection dialog
before the theme engine exists.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the vogella/theme-dark-attribute branch from 5cd65b6 to b863876 Compare September 9, 2026 17:34
@vogella
vogella merged commit 547df13 into eclipse-platform:master Sep 10, 2026
18 checks passed
@vogella
vogella deleted the vogella/theme-dark-attribute branch September 10, 2026 07:57
@vogella

vogella commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @BeckerWdf for the review

vogella added a commit to vogellacompany/eclipse-themes that referenced this pull request Sep 10, 2026
eclipse-platform/eclipse.platform.ui#4354 adds an isDarkTheme attribute
to the theme extension point for 2026-12. Set it to true on the five
dark themes and to false on One Light, so the platform no longer has to
guess from the id. Older releases ignore the attribute and keep using
the substring match, which the ids still satisfy.

Assisted-by: multiple AI agents and layers of automated tooling 🤖
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157cPD5VyXHbCQEUbiLZzvA
@BeckerWdf

Copy link
Copy Markdown
Member

@vogella in #4356 (comment) you said that with the PR merge a restart is not longer needed when switching between light and dark.
I just tested with yesterday's I-build (https://download.eclipse.org/eclipse/downloads/drops4/I20260913-2300).

But I still see the "restart" dialog when switching between dark and light:
image

@vogella

vogella commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@vogella in #4356 (comment) you said that with the PR merge a restart is not longer needed when switching between light and dark. I just tested with yesterday's I-build (https://download.eclipse.org/eclipse/downloads/drops4/I20260913-2300).

But I still see the "restart" dialog when switching between dark and light: <img alt="image" width="572" height="148" src="https://private-user-images.githubusercontent.com/28338612/651189834-22102673-5509-421c-9b47-29a5131ebd92.png?

I said no restart is required for different dark themes (dark -> dark) or different light themes (light -> light). You can test by installing additional themes, e.g. from https://github.com/vogellacompany/eclipse-themes

@BeckerWdf

Copy link
Copy Markdown
Member

I said no restart is required for different dark themes (dark -> dark) or different light themes (light -> light). You can test by installing additional themes, e.g. from https://github.com/vogellacompany/eclipse-themes

Ah ok. So then I mis-interpreted your text:

switching between different light and dark themes

Thanks for clarification.

@BeckerWdf

Copy link
Copy Markdown
Member

Btw: What would be needed to be fixed so that we no longer need to trigger a restart after a switch from light to dark theme?

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.

3 participants