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 code 40).

Red

Red: #1 (foreground code 31, background code 41).

Green

Green: #2 (foreground code 32, background code 42).

Yellow

Yellow: #3 (foreground code 33, background code 43).

Blue

Blue: #4 (foreground code 34, background code 44).

Magenta

Magenta: #5 (foreground code 35, background code 45).

Cyan

Cyan: #6 (foreground code 36, background code 46).

White

White: #7 (foreground code 37, background code 47).

BrightBlack

Bright black: #0 (foreground code 90, background code 100).

BrightRed

Bright red: #1 (foreground code 91, background code 101).

BrightGreen

Bright green: #2 (foreground code 92, background code 102).

BrightYellow

Bright yellow: #3 (foreground code 93, background code 103).

BrightBlue

Bright blue: #4 (foreground code 94, background code 104).

BrightMagenta

Bright magenta: #5 (foreground code 95, background code 105).

BrightCyan

Bright cyan: #6 (foreground code 96, background code 106).

BrightWhite

Bright white: #7 (foreground code 97, background code 107).

Implementations

impl AnsiColor

fn on(self, background: impl Into<Color>) -> Style

Create a [Style][crate::Style] with this as the foreground

const fn on_default(self) -> Style

Create a [Style][crate::Style] with this as the foreground

fn render_fg(self) -> impl Display + Copy

Render the ANSI code for a foreground color

fn render_bg(self) -> impl Display + Copy

Render the ANSI code for a background color

fn bright(self, yes: bool) -> Self

Change the color to/from bright

fn is_bright(self) -> bool

Report 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) -> T

Returns the argument unchanged.

impl<T> ToOwned for AnsiColor where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for AnsiColor where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses 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>