Skip to main content

DynColor

Trait DynColor 

Source
pub trait DynColor: Sealed {
    // Required methods
    fn fmt_ansi_fg(&self, f: &mut Formatter<'_>) -> Result;
    fn fmt_ansi_bg(&self, f: &mut Formatter<'_>) -> Result;
    fn fmt_raw_ansi_fg(&self, f: &mut Formatter<'_>) -> Result;
    fn fmt_raw_ansi_bg(&self, f: &mut Formatter<'_>) -> Result;
}
Expand description

A trait describing a runtime-configurable color which can displayed using FgDynColorDisplay or BgDynColorDisplay. If your color will be known at compile time it is recommended you avoid this.

Required Methods§

Source

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

A function to output a ANSI code to a formatter to set the foreground to this color

Source

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

A function to output a ANSI code to a formatter to set the background to this color

Source

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

A function to output a raw ANSI code to a formatter to set the foreground to this color, but without including the ANSI delimiters.

Source

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

A function to output a raw ANSI code to a formatter to set the background to this color, but without including the ANSI delimiters.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DynColor for str

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§