Expand description
“Follow system” appearance: detect the OS dark/light setting and map it to a preset.
Constants§
- SYSTEM_
DARK_ INDEX - Preset used while the system is in dark mode (index into
THEME_NAMES). - SYSTEM_
LIGHT_ INDEX - Preset used while the system is in light mode (index into
THEME_NAMES). - SYSTEM_
THEME_ NAME - Persisted
theme_namemeaning “follow the operating system’s light/dark setting”.
Functions§
- current_
system_ theme_ index - Preset index matching the current system appearance (dark if undetectable).
- detect_
system_ dark - Is the OS in dark mode?
Nonewhen it can’t be determined (callers pick a default). - is_
system_ name - Whether
nameis the “follow system” pseudo-theme (case-insensitive). - parse_
gsettings - Parse
gsettings get org.gnome.desktop.interface color-scheme('prefer-dark', …). - parse_
macos - Parse
defaults read -g AppleInterfaceStyleoutput (macOS): printsDarkin dark mode. - parse_
windows - Parse
reg query … /v AppsUseLightThemeoutput (Windows):0x0means dark. - system_
theme_ index - The preset index to show for a given system appearance.