pub struct Style { /* private fields */ }Available on crate feature
color only.Expand description
A stored style that can be applied.
Implementations§
Source§impl Style
impl Style
Sourcepub fn from_dotted_str(s: &str) -> Style
pub fn from_dotted_str(s: &str) -> Style
Creates 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_blue will
create a string that is red on blue background. 9.on_12 is
the same, but using 256 color numbers. Unknown terms are
ignored.
Sourcepub fn apply_to<D>(&self, val: D) -> StyledObject<D>
pub fn apply_to<D>(&self, val: D) -> StyledObject<D>
Apply the style to something that can be displayed.
Sourcepub const fn force_styling(self, value: bool) -> Style
pub const fn force_styling(self, value: bool) -> Style
Forces styling on or off.
This overrides the automatic detection.
Sourcepub const fn for_stderr(self) -> Style
pub const fn for_stderr(self) -> Style
Specifies that style is applying to something being written on stderr.
Sourcepub const fn for_stdout(self) -> Style
pub const fn for_stdout(self) -> Style
Specifies that style is applying to something being written on stdout.
This is the default behaviour.
pub const fn black(self) -> Style
pub const fn red(self) -> Style
pub const fn green(self) -> Style
pub const fn yellow(self) -> Style
pub const fn blue(self) -> Style
pub const fn magenta(self) -> Style
pub const fn cyan(self) -> Style
pub const fn white(self) -> Style
pub const fn color256(self, color: u8) -> Style
pub const fn bright(self) -> Style
pub const fn on_black(self) -> Style
pub const fn on_red(self) -> Style
pub const fn on_green(self) -> Style
pub const fn on_yellow(self) -> Style
pub const fn on_blue(self) -> Style
pub const fn on_magenta(self) -> Style
pub const fn on_cyan(self) -> Style
pub const fn on_white(self) -> Style
pub const fn on_color256(self, color: u8) -> Style
pub const fn on_bright(self) -> Style
pub const fn bold(self) -> Style
pub const fn dim(self) -> Style
pub const fn italic(self) -> Style
pub const fn underlined(self) -> Style
pub const fn blink(self) -> Style
pub const fn blink_fast(self) -> Style
pub const fn reverse(self) -> Style
pub const fn strikethrough(self) -> Style
Trait Implementations§
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more