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

terminal-colorsaurus

Determines the background and foreground color of the terminal

14 unstable releases (3 breaking)

0.4.3 Jun 10, 2024
0.4.2 May 30, 2024
0.3.4 Jun 10, 2024
0.3.3 Mar 16, 2024
0.1.0 Jan 20, 2024

#154 in Command-line interface

Download history 19/week @ 2024-02-26 7/week @ 2024-03-04 956/week @ 2024-03-11 1324/week @ 2024-03-18 593/week @ 2024-03-25 564/week @ 2024-04-01 588/week @ 2024-04-08 595/week @ 2024-04-15 546/week @ 2024-04-22 760/week @ 2024-04-29 827/week @ 2024-05-06 776/week @ 2024-05-13 406/week @ 2024-05-20 663/week @ 2024-05-27 499/week @ 2024-06-03 737/week @ 2024-06-10

2,409 downloads per month
Used in git-delta

MIT/Apache

44KB
887 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.5–11MB
~69K SLoC