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

terminal-colorsaurus

Determines the background and foreground color of the terminal

15 unstable releases (3 breaking)

new 0.4.4 Jul 18, 2024
0.4.2 May 30, 2024
0.3.3 Mar 16, 2024

#140 in Command-line interface

Download history 564/week @ 2024-03-27 541/week @ 2024-04-03 637/week @ 2024-04-10 556/week @ 2024-04-17 535/week @ 2024-04-24 998/week @ 2024-05-01 578/week @ 2024-05-08 754/week @ 2024-05-15 446/week @ 2024-05-22 654/week @ 2024-05-29 685/week @ 2024-06-05 571/week @ 2024-06-12 430/week @ 2024-06-19 404/week @ 2024-06-26 545/week @ 2024-07-03 656/week @ 2024-07-10

2,122 downloads per month
Used in git-delta

MIT/Apache

45KB
889 lines

terminal-colorsaurus 🦕

Docs Crate Version

Determines the background and foreground color of the terminal using the OSC 10 and OSC 11 escape codes.

This library helps answer the question «Is this terminal dark or light?».

Windows is unfortunately not supported.

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.6–8MB
~54K SLoC