Skip to content

window.systemColorTheme conflicts with window.autoDetectColorScheme #210902

Closed

Description

Setting 'window.systemColorTheme' to anything else than default, will cause window.autoDetectColorScheme to no longer work.

Internally it sets nativeTheme.themeSource which hard codenativeTheme.shouldUseDarkColors and prefers-color-scheme and disable the update event which we use to detect the current OS scheme event.

Solutions:
a. we disable window.systemColorTheme if window.autoDetectColorScheme is enabled. Disadvantage: This will no longer allow to redefine the color of context menus / menus and frames when window.autoDetectColorScheme is on
b. we no longer use the Electron API to detect light/dark color schemes but use CSS (`(prefers-color-scheme: light)``.
The problem here is that this will cause some rewrite. We can only get the value when we have a window, while before we could access that value in main and already initialize some window colors

Activity

  1. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor
  2. changed the title [-]'window.systemColorTheme' conflicts with `window.autoDetectColorScheme`[/-] [+]`window.systemColorTheme` conflicts with `window.autoDetectColorScheme`[/+] on Apr 22, 2024
  3. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor

    Looks like b is not an option as setting nativeTheme.themeSourc will define what
    window.matchMedia((prefers-color-scheme: light)).matches returns

  4. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor

    Ideally Electron would untangle the API that allows to detect the OS color scheme (mode) from the configuration of the Windows color mode. Robo (@deepak1556)

  5. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor

    Maybe we just rename window.systemColorTheme: auto to 'match theme'

  6. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor

    The problem with window.systemColorTheme: auto is that we can configure a theme per window.

  7. aeschli commented on Apr 22, 2024

    @aeschli
    ContributorAuthor

    I now clarified in the settings descriptions that window.autoDetectColorScheme is ignored if window.systemColorTheme hardcodes a system color.

    Also I renamed window.systemColorTheme: auto to window.systemColorTheme: matchColorTheme
    (PR: #210923)

  8. added
    themes
    bug
    on Apr 22, 2024
  9. locked and limited conversation to collaborators on Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugthemesverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions