Skip to content

Let themes declare that they are dark - #4354

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:vogella/theme-dark-attribute
Open

Let themes declare that they are dark#4354
vogella wants to merge 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
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