Struct RgbColor

pub struct RgbColor(pub u8, pub u8, pub u8);

24-bit ANSI RGB color codes

Fields

0: u8
1: u8
2: u8

Implementations

impl RgbColor

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

const fn r(self) -> u8

Red

const fn g(self) -> u8

Green

const fn b(self) -> u8

Blue

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

Trait Implementations

impl Clone for RgbColor

fn clone(&self) -> RgbColor

impl Copy for RgbColor

impl Debug for RgbColor

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for RgbColor

impl From<(u8, u8, u8)> for RgbColor

fn from(inner: (u8, u8, u8)) -> Self

impl Hash for RgbColor

fn hash<__H: Hasher>(&self, state: &mut __H)

impl Ord for RgbColor

fn cmp(&self, other: &RgbColor) -> Ordering

impl PartialEq for RgbColor

fn eq(&self, other: &RgbColor) -> bool

impl PartialOrd for RgbColor

fn partial_cmp(&self, other: &RgbColor) -> Option<Ordering>

impl StructuralPartialEq for RgbColor

Auto Trait Implementations

impl Freeze for RgbColor

impl RefUnwindSafe for RgbColor

impl Send for RgbColor

impl Sync for RgbColor

impl Unpin for RgbColor

impl UnsafeUnpin for RgbColor

impl UnwindSafe for RgbColor

Blanket Implementations

impl<T> Any for RgbColor where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for RgbColor where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for RgbColor where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for RgbColor where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for RgbColor

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> Into<U> for RgbColor 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 RgbColor where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for RgbColor where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>