| Crates.io | terminal-colorsaurus |
| lib.rs | terminal-colorsaurus |
| version | 1.0.3 |
| created_at | 2024-01-20 19:40:53.285611+00 |
| updated_at | 2025-12-28 15:53:25.116877+00 |
| description | A cross-platform library for determining the terminal's background and foreground color. It answers the question «Is this terminal dark or light?». |
| homepage | |
| repository | https://github.com/tautropfli/terminal-colorsaurus |
| max_upload_size | |
| id | 1106783 |
| size | 106,137 |
A cross-platform library for determining the terminal's background and foreground color.
It answers the question «Is this terminal dark or light?».
Works in all major terminals including Windows Terminal (starting with v1.22).
use terminal_colorsaurus::{theme_mode, QueryOptions, ThemeMode};
match theme_mode(QueryOptions::default()).unwrap() {
ThemeMode::Dark => { /* ... */ },
ThemeMode::Light => { /* ... */ },
}
This crate's Minimum Supported Rust Version (MSRV) is based
on the MSRVs of downstream users such as delta and bat.
Changes to the MSRV will be accompanied by a minor version bump.
The following formula determines the MSRV:
min(msrv(bat), msrv(delta))
This crate borrows ideas from many other projects. This list is by no means exhaustive.
mio to wait for the terminal's response with a timeout.DA1 trick
to easily detect terminals that don't support querying the colors with OSC 10 / OSC 11.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.