#dark #color-scheme #light #appearance #themes #apple-interface-style

is-dark-theme

Check if macOS is configured to use a Dark Mode appearance

1 stable release

1.0.0 Mar 18, 2024

#54 in macOS and iOS APIs

Download history 92/week @ 2024-03-12 44/week @ 2024-03-19 4/week @ 2024-03-26 17/week @ 2024-04-02

157 downloads per month

Apache-2.0 OR MIT

5KB
58 lines

Check whether the system is set to a Dark Mode style

This checks a global system default. It is intended for headless tools or programs that can't access their windows. It may not be accurate when specific screens or applications have a different theme set. If you control your GUI, please check window-specific properties instead (on macOS that is NSAppearance protocol).

On macOS this crate uses Core Foundation to read a AppleInterfaceStyle global setting, which is equivalent of:

defaults read -g AppleInterfaceStyle

On other platforms only None is returned. Please submit pull requests for more OSes!


lib.rs:

Check whether the system is set to a "dark" theme.

This checks a global system default. It is intended for headless tools or programs that can't access their windows. It may not be accurate when specific screens or applications have a different theme set. If you control your GUI, please check window-specific properties instead (on macOS that is NSAppearance protocol).

On macOS this crate uses Core Foundation to read a AppleInterfaceStyle global setting, which is equivalent of:

defaults read -g AppleInterfaceStyle

On other platforms only None is returned. Please submit pull requests for more OSes!

Dependencies

~46KB