Struct Style
pub struct Style { /* private fields */ }
A stored style that can be applied.
Implementations
impl Style
const fn new() -> SelfReturns an empty default style.
fn from_dotted_str(s: &str) -> SelfCreates a style from a dotted string.
Effectively the string is split at each dot and then the terms in between are applied. For instance
red.on_bluewill create a string that is red on blue background.9.on_12is the same, but using 256 color numbers. Unknown terms are ignored.fn apply_to<D>(&self, val: D) -> StyledObject<D>Apply the style to something that can be displayed.
const fn force_styling(self, value: bool) -> SelfForces styling on or off.
This overrides the automatic detection.
const fn for_stderr(self) -> SelfSpecifies that style is applying to something being written on stderr.
const fn for_stdout(self) -> SelfSpecifies that style is applying to something being written on stdout.
This is the default behaviour.
const fn fg(self, color: Color) -> SelfSets a foreground color.
const fn bg(self, color: Color) -> SelfSets a background color.
const fn attr(self, attr: Attribute) -> SelfAdds a attr.
const fn black(self) -> Selfconst fn red(self) -> Selfconst fn green(self) -> Selfconst fn yellow(self) -> Selfconst fn blue(self) -> Selfconst fn magenta(self) -> Selfconst fn cyan(self) -> Selfconst fn white(self) -> Selfconst fn color256(self, color: u8) -> Selfconst fn true_color(self, r: u8, g: u8, b: u8) -> Selfconst fn bright(self) -> Selfconst fn on_black(self) -> Selfconst fn on_red(self) -> Selfconst fn on_green(self) -> Selfconst fn on_yellow(self) -> Selfconst fn on_blue(self) -> Selfconst fn on_magenta(self) -> Selfconst fn on_cyan(self) -> Selfconst fn on_white(self) -> Selfconst fn on_color256(self, color: u8) -> Selfconst fn on_true_color(self, r: u8, g: u8, b: u8) -> Selfconst fn on_bright(self) -> Selfconst fn bold(self) -> Selfconst fn dim(self) -> Selfconst fn italic(self) -> Selfconst fn underlined(self) -> Selfconst fn blink(self) -> Selfconst fn blink_fast(self) -> Selfconst fn reverse(self) -> Selfconst fn strikethrough(self) -> Self
Trait Implementations
impl Clone for Style
fn clone(&self) -> Self
impl Debug for Style
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Style
fn default() -> Self
impl Eq for Style
impl PartialEq for Style
fn eq(&self, other: &Self) -> bool