1
0
Fork
You've already forked supports-color
0
Detects whether a terminal supports color, and gives details about that support
  • Rust 100%
2024年11月26日 01:05:00 -08:00
.github fix(clicolor): Ignore unit tests on GH action and change order of CLICOLOR check ( #5 ) 2021年10月02日 20:21:02 -07:00
src fix(unsafe): Remove unsafe code in favor of OnceLock ( #20 ) 2024年11月12日 10:40:27 -08:00
tests tests: Add miri testing of cache unsafe code to CI ( #2 ) 2021年09月22日 15:26:18 -07:00
.editorconfig meta: add .editorconfig 2021年09月11日 00:38:28 -07:00
.gitignore feat(api): initial commit 2021年09月10日 22:50:51 -07:00
Cargo.toml chore: Release supports-color version 3.0.2 2024年11月26日 01:05:00 -08:00
CHANGELOG.md docs: update changelog 2024年11月26日 01:03:26 -08:00
cliff.toml meta: fix cliff.toml 2021年09月22日 09:47:10 -07:00
LICENSE feat(api): initial commit 2021年09月10日 22:50:51 -07:00
Makefile.toml feat(api): initial commit 2021年09月10日 22:50:51 -07:00
README.md fix(docs): Update README example for accuracy ( #7 ) 2022年11月05日 14:47:06 -07:00

Detects whether a terminal supports color, and gives details about that support. It takes into account the NO_COLOR environment variable.

This crate is a Rust port of @sindresorhus' NPM package by the same name.

Example

usesupports_color::Stream;ifletSome(support)=supports_color::on(Stream::Stdout){ifsupport.has_16m{println!("16 million (RGB) colors are supported");}elseifsupport.has_256{println!("256 colors are supported.");}elseifsupport.has_basic{println!("Only basic ANSI colors are supported.");}}else{println!("No color support.");}