+
Skip to content

Expose Windows shell/system color theme in Electron #46429

@riverar

Description

@riverar

Preflight Checklist

Problem Description

Electron currently lacks the ability to detect the Windows system/shell color theme that controls the taskbar, Start menu, and other OS shell elements. The existing nativeTheme.shouldUseDarkColors only detects the Windows application color mode setting, which can be configured separately from the system theme.

This limitation creates a disconnect for Electron applications that aim to provide a truly native experience. Users can have light mode applications with a dark taskbar (or vice versa), but Electron apps have no built-in way to detect or respond to this system-level setting.

💡 There's already a PR that completed the ask (see below), so remaining work as I see it is:

  • ensure appropriate values are provided for macOS and Linux
  • API name review/renaming exercise

Proposed Solution

Expose Chromium ShouldUseDarkColorsForSystemIntegratedUI property.
https://source.chromium.org/chromium/chromium/src/+/main:ui/native_theme/native_theme_win.cc;l=1689-1708

Or add a new property shouldUseDarkColorsInSystemIntegratedUI to the nativeTheme API:

console.log(nativeTheme.shouldUseDarkColorsInSystemIntegratedUI) // true | false

This would enable Electron developers to:

  • Create window frames that match the taskbar appearance (e.g., fly-outs, notifications)
  • Adjust system-adjacent UI elements to match the shell theme (e.g., system tray icons)
  • Provide a fully coherent visual experience that respects all user preferences

The implementation details are flexible, but the core need is to expose this system-level theme information somehow.

Alternatives Considered

  1. Raw registry access: Directly reading well-known Windows registry values, which requires Electron non-idiomatic / native code
  2. User configuration: Simply asking users to manually set preferences, which provides a very poor user experience

Additional Information

I've created an Electron Fiddle demonstrating the issue and compiled screenshots showing the discrepancy between application and system theme settings in Windows.

https://gist.github.com/riverar/feae53c60539cb162738de69a93e1e70

This is a basic OS integration feature that should be part of Electron's core functionality. While it may require extending what's available in the Chromium code-base, that's precisely the value Electron provides - enhancing Chromium for application development. A framework designed for desktop applications should support the bare necessities to ensure an OS-native experience.

Related issues and prior work:

#19729
#31898
https://source.chromium.org/chromium/chromium/src/+/main:ui/native_theme/native_theme_win.cc;l=1689-1708

Highly related PR that can be tweaked and merged:

#19735

Screenshots

System color: Light / Electron shouldUseDarkColors: false

Image

System color: Dark / Electron shouldUseDarkColors: false

Image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载