Struct ColorSpec
pub struct ColorSpec { /* private fields */ }
A color specification.
Implementations
impl ColorSpec
fn new() -> ColorSpecCreate a new color specification that has no colors or styles.
fn fg(&self) -> Option<&Color>Get the foreground color.
fn set_fg(&mut self, color: Option<Color>) -> &mut ColorSpecSet the foreground color.
fn bg(&self) -> Option<&Color>Get the background color.
fn set_bg(&mut self, color: Option<Color>) -> &mut ColorSpecSet the background color.
fn bold(&self) -> boolGet whether this is bold or not.
Note that the bold setting has no effect in a Windows console.
fn set_bold(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is bolded or not.
Note that the bold setting has no effect in a Windows console.
fn dimmed(&self) -> boolGet whether this is dimmed or not.
Note that the dimmed setting has no effect in a Windows console.
fn set_dimmed(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is dimmed or not.
Note that the dimmed setting has no effect in a Windows console.
fn italic(&self) -> boolGet whether this is italic or not.
Note that the italic setting has no effect in a Windows console.
fn set_italic(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is italicized or not.
Note that the italic setting has no effect in a Windows console.
fn underline(&self) -> boolGet whether this is underline or not.
Note that the underline setting has no effect in a Windows console.
fn set_underline(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is underlined or not.
Note that the underline setting has no effect in a Windows console.
fn strikethrough(&self) -> boolGet whether this is strikethrough or not.
Note that the strikethrough setting has no effect in a Windows console.
fn set_strikethrough(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is strikethrough or not.
Note that the strikethrough setting has no effect in a Windows console.
fn reset(&self) -> boolGet whether reset is enabled or not.
reset is enabled by default. When disabled and using ANSI escape sequences, a "reset" code will be emitted every time a
ColorSpec's settings are applied.Note that the reset setting has no effect in a Windows console.
fn set_reset(&mut self, yes: bool) -> &mut ColorSpecSet whether to reset the terminal whenever color settings are applied.
reset is enabled by default. When disabled and using ANSI escape sequences, a "reset" code will be emitted every time a
ColorSpec's settings are applied.Typically this is useful if callers have a requirement to more scrupulously manage the exact sequence of escape codes that are emitted when using ANSI for colors.
Note that the reset setting has no effect in a Windows console.
fn intense(&self) -> boolGet whether this is intense or not.
On Unix-like systems, this will output the ANSI escape sequence that will print a high-intensity version of the color specified.
On Windows systems, this will output the ANSI escape sequence that will print a brighter version of the color specified.
fn set_intense(&mut self, yes: bool) -> &mut ColorSpecSet whether the text is intense or not.
On Unix-like systems, this will output the ANSI escape sequence that will print a high-intensity version of the color specified.
On Windows systems, this will output the ANSI escape sequence that will print a brighter version of the color specified.
fn is_none(&self) -> boolReturns true if this color specification has no colors or styles.
fn clear(&mut self)Clears this color specification so that it has no color/style settings.
Trait Implementations
impl Clone for ColorSpec
fn clone(&self) -> ColorSpec
impl Debug for ColorSpec
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for ColorSpec
fn default() -> ColorSpec
impl Eq for ColorSpec
impl PartialEq for ColorSpec
fn eq(&self, other: &ColorSpec) -> bool
impl StructuralPartialEq for ColorSpec
Auto Trait Implementations
impl Freeze for ColorSpec
impl RefUnwindSafe for ColorSpec
impl Send for ColorSpec
impl Sync for ColorSpec
impl Unpin for ColorSpec
impl UnsafeUnpin for ColorSpec
impl UnwindSafe for ColorSpec
Blanket Implementations
impl<T> Any for ColorSpec
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ColorSpec
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ColorSpec
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ColorSpec
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ColorSpec
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ColorSpec
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for ColorSpec
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 ColorSpec
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ColorSpec
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>