terminal-colorsaurus 0.1.0

Determines the background and foreground color of the terminal
Documentation

terminal-colorsaurus 🦕

Docs Crate Version

Determines the background and foreground color of the terminal using the OSC 10 and OSC 11 terminal sequence. On Windows, the colors are queried using the Win32 Console API.

This is useful for answering the question "Is this terminal dark or light?".

Example

use terminal_colorsaurus::{color_scheme, QueryOptions};

let colors = color_scheme(QueryOptions::default()).unwrap();
dbg!(colors.is_dark_on_light());

Docs

Wishlist

These are some features that I would like to include in this crate, but have not yet had the time to implement. PRs are welcome :)

  • A CLI tool version of this library.
  • Improve dynamic latency strategy (iTerm is a bit of a headache here as it has quite a big range when it comes to latency).
  • Add support for $COLORFGBG (I don't know if this is a good idea actually, the readme of terminal-light lists some downsides.)

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.