Skip to content

A library for answering the question «Is this terminal dark or light?» 🦕

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
license-apache.txt
MIT
license-mit.txt
Notifications You must be signed in to change notification settings

bash/terminal-colorsaurus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f99ff45 · Jan 24, 2025
Jan 3, 2025
May 30, 2024
Jan 24, 2025
Jan 3, 2025
Mar 15, 2024
Jan 6, 2025
Jan 24, 2025
Jan 24, 2025
Jan 3, 2025
Jan 24, 2025
Dec 11, 2024
Jan 17, 2024
Nov 26, 2024
Dec 11, 2024
Sep 3, 2024

Repository files navigation

terminal-colorsaurus 🦕

Docs Crate Version

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).

Example

use terminal_colorsaurus::{color_scheme, QueryOptions, ColorScheme};

match color_scheme(QueryOptions::default()).unwrap() {
    ColorScheme::Dark => { /* ... */ },
    ColorScheme::Light => { /* ... */ },
}

Inspiration

This crate borrows ideas from many other projects. This list is by no means exhaustive.

License

Licensed under either of

at your option.

Contribution

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.