#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

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

#101 in Command-line interface

Download history 716/week @ 2024-10-07 533/week @ 2024-10-14 614/week @ 2024-10-21 619/week @ 2024-10-28 1023/week @ 2024-11-04 1363/week @ 2024-11-11 1544/week @ 2024-11-18 1594/week @ 2024-11-25 1123/week @ 2024-12-02 769/week @ 2024-12-09 645/week @ 2024-12-16 583/week @ 2024-12-23 1626/week @ 2024-12-30 8365/week @ 2025-01-06 8841/week @ 2025-01-13 6178/week @ 2025-01-20

25,066 downloads per month
Used in 8 crates (2 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