Struct tabled::settings::Color

source ·
pub struct Color { /* private fields */ }
Available on crate feature std only.
Expand description

Color represents a color which can be set to things like Border, Padding and Margin.

Example

use tabled::{settings::Color, Table};

let data = [
    (0u8, "Hello"),
    (1u8, "World"),
];

let table = Table::new(data)
    .with(Color::BG_BLUE)
    .to_string();

println!("{}", table);

Implementations§

source§

impl Color

source

pub const FG_BLACK: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BLUE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_BLACK: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_BLUE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_CYAN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_GREEN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_MAGENTA: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_RED: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_WHITE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_BRIGHT_YELLOW: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_CYAN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_GREEN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_MAGENTA: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_RED: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_WHITE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const FG_YELLOW: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BLACK: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BLUE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_BLACK: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_BLUE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_CYAN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_GREEN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_MAGENTA: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_RED: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_WHITE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_BRIGHT_YELLOW: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_CYAN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_GREEN: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_MAGENTA: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_RED: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_WHITE: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BG_YELLOW: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source

pub const BOLD: Self = _

A color representation.

Notice that the colors are constants so you can’t combine them.

source§

impl Color

source

pub fn new<P, S>(prefix: P, suffix: S) -> Self
where P: Into<String>, S: Into<String>,

Creates a new Color instance, with ANSI prefix and ANSI suffix. You can use [TryFrom] to construct it from [String`].

source

pub fn empty() -> Self

Creates a new empty Color`.

source

pub fn get_prefix(&self) -> &str

Return a prefix.

source

pub fn get_suffix(&self) -> &str

Return a suffix.

Trait Implementations§

source§

impl ANSIFmt for Color

source§

fn fmt_ansi_prefix<W: Write>(&self, f: &mut W) -> Result

Print ANSI prefix.
source§

fn fmt_ansi_suffix<W: Write>(&self, f: &mut W) -> Result

Print ANSI suffix.
source§

impl BitOr for Color

§

type Output = Color

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl<R> CellOption<R, ColoredConfig> for &Color

source§

fn change(self, _: &mut R, cfg: &mut ColoredConfig, entity: Entity)

Modification function of a certail part of a grid targeted by Entity.
source§

fn hint_change(&self) -> Option<Entity>

A hint whether an TableOption is going to change table layout. Read more
source§

impl<R> CellOption<R, ColoredConfig> for Color

source§

fn change(self, _: &mut R, cfg: &mut ColoredConfig, entity: Entity)

Modification function of a certail part of a grid targeted by Entity.
source§

fn hint_change(&self) -> Option<Entity>

A hint whether an TableOption is going to change table layout. Read more
source§

impl Clone for Color

source§

fn clone(&self) -> Color

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Color

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Color

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<ANSIBuf> for Color

source§

fn from(color: ANSIBuf) -> Self

Converts to this type from the input type.
source§

impl From<Color> for ANSIBuf

source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl Hash for Color

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Color

source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Color

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Color

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<R, D> TableOption<R, ColoredConfig, D> for Color

source§

fn change(self, _: &mut R, cfg: &mut ColoredConfig, _: &mut D)

The function modificaties of records and a grid configuration.
source§

fn hint_change(&self) -> Option<Entity>

A hint whether an TableOption is going to change table layout. Read more
source§

impl TryFrom<&str> for Color

Available on crate feature ansi only.
§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for Color

Available on crate feature ansi only.
§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(value: String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Color

source§

impl StructuralEq for Color

source§

impl StructuralPartialEq for Color

Auto Trait Implementations§

§

impl RefUnwindSafe for Color

§

impl Send for Color

§

impl Sync for Color

§

impl Unpin for Color

§

impl UnwindSafe for Color

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.