#[repr(u8)]pub enum ColorDepth {
Mono = 0,
Ansi16 = 1,
Ansi256 = 2,
TrueColor = 3,
}Expand description
Maximum color fidelity the terminal may receive.
This is a single ordered capability rather than independent booleans so impossible states such as “truecolor but not 256-color” cannot exist.
Variants§
Mono = 0
Do not emit foreground or background color sequences.
Ansi16 = 1
Standard 16-color ANSI palette.
Ansi256 = 2
Extended 256-color ANSI palette.
TrueColor = 3
Full 24-bit RGB color.
Implementations§
Source§impl ColorDepth
impl ColorDepth
Sourcepub fn detect() -> ColorDepth
pub fn detect() -> ColorDepth
Detect color depth using the canonical terminal capability detector.
Sourcepub fn detect_from_env(
no_color: Option<&str>,
colorterm: Option<&str>,
term: Option<&str>,
) -> ColorDepth
pub fn detect_from_env( no_color: Option<&str>, colorterm: Option<&str>, term: Option<&str>, ) -> ColorDepth
Detect color depth from explicit environment values.
NO_COLOR presence wins over every terminal signal. TERM=dumb,
TERM=vt100, and a missing/empty TERM are monochrome. Direct-color
TERM variants (*-direct[digits], *-truecolor, and *-24bit) receive
truecolor. Plain xterm and other non-dumb terminals conservatively
receive ANSI16.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Stable identifier used in diagnostics and evidence logs.
Sourcepub const fn supports_color(self) -> bool
pub const fn supports_color(self) -> bool
Whether any color sequences may be emitted.
Sourcepub const fn supports_256_colors(self) -> bool
pub const fn supports_256_colors(self) -> bool
Whether the terminal supports at least the 256-color palette.
Sourcepub const fn supports_true_color(self) -> bool
pub const fn supports_true_color(self) -> bool
Whether the terminal supports 24-bit RGB color.
Trait Implementations§
Source§impl Clone for ColorDepth
impl Clone for ColorDepth
Source§fn clone(&self) -> ColorDepth
fn clone(&self) -> ColorDepth
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more