https://github.com/kornelski/is-dark-theme
Hacky check whether macOS is configured to use a Dark Mode appearance
https://github.com/kornelski/is-dark-theme
dark-theme light-theme macos prefers-color-scheme rust-library
Last synced: 10 months ago
JSON representation
Hacky check whether macOS is configured to use a Dark Mode appearance
- Host: GitHub
- URL: https://github.com/kornelski/is-dark-theme
- Owner: kornelski
- License: mit
- Created: 2024-03-18T02:13:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T02:23:06.000Z (over 2 years ago)
- Last Synced: 2025-01-12T06:30:30.417Z (over 1 year ago)
- Topics: dark-theme, light-theme, macos, prefers-color-scheme, rust-library
- Language: Rust
- Homepage: https://lib.rs/is-dark-theme
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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:
```bash
defaults read -g AppleInterfaceStyle
```
On other platforms only `None` is returned. Please submit pull requests for more OSes!