pub enum ColorSupport {
None,
Ansi16,
Ansi256,
TrueColor,
}Expand description
How many colors the terminal can show.
Variants§
None
No colors at all (NO_COLOR set or TERM=dumb).
Ansi16
The 16 basic ANSI colors.
Ansi256
The xterm 256-color palette.
TrueColor
24-bit RGB.
Implementations§
Source§impl ColorSupport
impl ColorSupport
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect support from the process environment (NO_COLOR, COLORTERM, TERM).
Sourcepub fn from_env(
no_color: Option<&str>,
colorterm: Option<&str>,
term: Option<&str>,
) -> Self
pub fn from_env( no_color: Option<&str>, colorterm: Option<&str>, term: Option<&str>, ) -> Self
Pure detection logic behind ColorSupport::detect, for testing and
for apps that read the environment themselves.
- a non-empty
no_color→ColorSupport::None(https://no-color.org) COLORTERMoftruecolor/24bit, orTERMcontainingdirect→ true colorTERMcontaining256color→ 256 colorsTERMofdumb→ none; anything else → 16 colors
Sourcepub fn downgrade_color(self, color: Color) -> Color
pub fn downgrade_color(self, color: Color) -> Color
Reduce one color to what this support level can show.
Trait Implementations§
Source§impl Clone for ColorSupport
impl Clone for ColorSupport
impl Copy for ColorSupport
Source§impl Debug for ColorSupport
impl Debug for ColorSupport
impl Eq for ColorSupport
Source§impl Hash for ColorSupport
impl Hash for ColorSupport
Source§impl Ord for ColorSupport
impl Ord for ColorSupport
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ColorSupport
impl PartialEq for ColorSupport
Source§impl PartialOrd for ColorSupport
impl PartialOrd for ColorSupport
impl StructuralPartialEq for ColorSupport
Auto Trait Implementations§
impl Freeze for ColorSupport
impl RefUnwindSafe for ColorSupport
impl Send for ColorSupport
impl Sync for ColorSupport
impl Unpin for ColorSupport
impl UnsafeUnpin for ColorSupport
impl UnwindSafe for ColorSupport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more