#terminal-colors #color-scheme #light #dark #terminal

terminal-colorsaurus

A cross-platform library for determining the terminal's background and foreground color. It answers the question «Is this terminal dark or light?».

19 releases

0.4.8 Jan 24, 2025
0.4.7 Nov 26, 2024
0.4.4 Jul 18, 2024
0.3.3 Mar 16, 2024

#104 in Command-line interface

Download history 698/week @ 2024-10-30 1116/week @ 2024-11-06 1451/week @ 2024-11-13 1516/week @ 2024-11-20 1555/week @ 2024-11-27 1046/week @ 2024-12-04 683/week @ 2024-12-11 637/week @ 2024-12-18 771/week @ 2024-12-25 2316/week @ 2025-01-01 10157/week @ 2025-01-08 8060/week @ 2025-01-15 7412/week @ 2025-01-22 7882/week @ 2025-01-29 9112/week @ 2025-02-05 7934/week @ 2025-02-12

33,256 downloads per month
Used in 10 crates (3 directly)

MIT/Apache

55KB
993 lines

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 => { /* ... */ },
}

Docs

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.

Dependencies

~0.4–8.5MB
~67K SLoC