Enum AnsiColor
#[repr(u8)]
pub enum AnsiColor
Available 4-bit ANSI color palette codes
The user's terminal defines the meaning of each palette code.
Variants
-
Black Black: #0 (foreground code
30, background code40).-
Red Red: #1 (foreground code
31, background code41).-
Green Green: #2 (foreground code
32, background code42).-
Yellow Yellow: #3 (foreground code
33, background code43).-
Blue Blue: #4 (foreground code
34, background code44).-
Magenta Magenta: #5 (foreground code
35, background code45).-
Cyan Cyan: #6 (foreground code
36, background code46).-
White White: #7 (foreground code
37, background code47).-
BrightBlack Bright black: #0 (foreground code
90, background code100).-
BrightRed Bright red: #1 (foreground code
91, background code101).-
BrightGreen Bright green: #2 (foreground code
92, background code102).-
BrightYellow Bright yellow: #3 (foreground code
93, background code103).-
BrightBlue Bright blue: #4 (foreground code
94, background code104).-
BrightMagenta Bright magenta: #5 (foreground code
95, background code105).-
BrightCyan Bright cyan: #6 (foreground code
96, background code106).-
BrightWhite Bright white: #7 (foreground code
97, background code107).
Implementations
impl AnsiColor
fn on(self, background: impl Into<Color>) -> StyleCreate a [
Style][crate::Style] with this as the foregroundconst fn on_default(self) -> StyleCreate a [
Style][crate::Style] with this as the foregroundfn render_fg(self) -> impl Display + CopyRender the ANSI code for a foreground color
fn render_bg(self) -> impl Display + CopyRender the ANSI code for a background color
fn bright(self, yes: bool) -> SelfChange the color to/from bright
fn is_bright(self) -> boolReport whether the color is bright
Trait Implementations
impl Clone for AnsiColor
fn clone(&self) -> AnsiColor
impl Copy for AnsiColor
impl Debug for AnsiColor
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for AnsiColor
impl Hash for AnsiColor
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for AnsiColor
fn cmp(&self, other: &AnsiColor) -> Ordering
impl PartialEq for AnsiColor
fn eq(&self, other: &AnsiColor) -> bool
impl PartialOrd for AnsiColor
fn partial_cmp(&self, other: &AnsiColor) -> Option<Ordering>
impl StructuralPartialEq for AnsiColor
Auto Trait Implementations
impl Freeze for AnsiColor
impl RefUnwindSafe for AnsiColor
impl Send for AnsiColor
impl Sync for AnsiColor
impl Unpin for AnsiColor
impl UnsafeUnpin for AnsiColor
impl UnwindSafe for AnsiColor
Blanket Implementations
impl<T> Any for AnsiColor
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for AnsiColor
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for AnsiColor
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for AnsiColor
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for AnsiColor
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for AnsiColor
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for AnsiColor
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for AnsiColor
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for AnsiColor
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>