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

terminal-colorsaurus

Determines the background and foreground color of the terminal

17 releases

new 0.4.6 Nov 21, 2024
0.4.4 Jul 18, 2024
0.3.3 Mar 16, 2024

#98 in Command-line interface

Download history 1205/week @ 2024-08-04 1236/week @ 2024-08-11 1504/week @ 2024-08-18 949/week @ 2024-08-25 1067/week @ 2024-09-01 1009/week @ 2024-09-08 676/week @ 2024-09-15 699/week @ 2024-09-22 911/week @ 2024-09-29 791/week @ 2024-10-06 573/week @ 2024-10-13 625/week @ 2024-10-20 590/week @ 2024-10-27 955/week @ 2024-11-03 1328/week @ 2024-11-10 1481/week @ 2024-11-17

4,405 downloads per month
Used in git-delta

MIT/Apache

46KB
911 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?».

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
~73K SLoC