Enum Color
pub enum Color
Any ANSI color code scheme
Variants
-
Ansi(AnsiColor) Available 4-bit ANSI color palette codes
The user's terminal defines the meaning of each palette code.
-
Ansi256(Ansi256Color) 256 (8-bit) color support
-
Rgb(RgbColor) 24-bit ANSI RGB color codes
Implementations
impl Color
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
Trait Implementations
impl Clone for Color
fn clone(&self) -> Self
impl Copy for Color
impl Debug for Color
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Color
impl From<(u8, u8, u8)> for Color
fn from(inner: (u8, u8, u8)) -> Self
impl From<Ansi256Color> for Color
fn from(inner: Ansi256Color) -> Self
impl From<AnsiColor> for Color
fn from(inner: AnsiColor) -> Self
impl From<RgbColor> for Color
fn from(inner: RgbColor) -> Self
impl From<u8> for Color
fn from(inner: u8) -> Self
impl Hash for Color
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for Color
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for Color
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Color
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
impl StructuralPartialEq for Color
Auto Trait Implementations
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations
impl<T> Any for Color
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Color
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Color
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Color
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Color
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Color
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Color
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 Color
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Color
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>