Detected Dark / Light / System mode

“wx.SystemSettings.GetAppearance()” no longer seems to work with “wxpython-4.3.0a16030 and wxWidgets 3.3.0”.

I know this isn’t a final version, but is this normal?
01__wx.SystemAppearance.py (1.8 KB)
02__dark_mode.py (4.2 KB)

If anyone would like to test these scripts on their system and let me know if they work, I would be very grateful (please provide me with the following information: wxPython, wxWidgets, operating system version, etc.).

Also, like many other users, I would like to see an example of using dark mode as soon as possible to begin various tests.

Thanks

Not an answer to the question but:

__IS_DARK_THEME:bool=None   # hash calculation, requires client restart for dark/ligth theme change

def is_probably_dark_theme():
    global __IS_DARK_THEME
    if __IS_DARK_THEME is not None:
        return __IS_DARK_THEME

    bg_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
    # detect if light/dark color
    brightness = (bg_colour.Red() * 299 + bg_colour.Green() * 587 + bg_colour.Blue() * 114) / 1000
    __IS_DARK_THEME = (brightness < 128)        # dark background/theme ?
    _log.debug('wx.SYS_COLOUR_WINDOW brightness: %s', brightness)
    _log.debug('considered dark theme: %s (brightness < 128)', __IS_DARK_THEME)
    return __IS_DARK_THEME

might come in handy.

Karsten

#1 works correctly on Fedora 43 (Linux) but #2 does not.

I think for #2 you would want (maybe this is a newer way?):
gsettings get org.gnome.desktop.interface color-scheme

@Zig_Zag you may want to read the wxWidgets documentation for now until wxPython documentation is updated. Note the MSW specifics there about IsDark().

https://docs.wxwidgets.org/latest/classwx_system_appearance.html