[−][src]Struct crossterm::style::Colors
Represents, optionally, a foreground and/or a background color.
It can be applied using the SetColors
command.
It can also be created from a Colored value or a tuple of
(Color, Color)
in the order (foreground, background)
.
The then method can be used to combine Colors
values.
For example:
use crossterm::style::{Color, Colors, Colored}; // An example color, loaded from a config, file in ANSI format. let config_color = "38;2;23;147;209"; // Default to green text on a black background. let default_colors = Colors::new(Color::Green, Color::Black); // Load a colored value from a config and override the default colors let colors = match Colored::parse_ansi(config_color) { Some(colored) => default_colors.then(&colored.into()), None => default_colors, };
See Color.
Fields
foreground: Option<Color>
background: Option<Color>
Implementations
impl Colors
[src]
pub fn then(&self, other: &Colors) -> Colors
[src]
Returns a new Color
which, when applied, has the same effect as applying self
and then
other
.
impl Colors
[src]
Trait Implementations
impl Clone for Colors
[src]
impl Copy for Colors
[src]
impl Debug for Colors
[src]
impl Eq for Colors
[src]
impl From<Colored> for Colors
[src]
impl PartialEq<Colors> for Colors
[src]
impl StructuralEq for Colors
[src]
impl StructuralPartialEq for Colors
[src]
Auto Trait Implementations
impl RefUnwindSafe for Colors
[src]
impl Send for Colors
[src]
impl Sync for Colors
[src]
impl Unpin for Colors
[src]
impl UnwindSafe for Colors
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,