Struct termimad::CompoundStyle
source · pub struct CompoundStyle {
pub object_style: ContentStyle,
}
Expand description
A style which may be applied to a compound
Fields§
§object_style: ContentStyle
Implementations§
source§impl CompoundStyle
impl CompoundStyle
sourcepub fn apply_to<D>(&self, val: D) -> StyledContent<D>
pub fn apply_to<D>(&self, val: D) -> StyledContent<D>
Apply an StyledContent
to the passed displayable object.
sourcepub const fn new(
foreground_color: Option<Color>,
background_color: Option<Color>,
attributes: Attributes
) -> CompoundStyle
pub const fn new( foreground_color: Option<Color>, background_color: Option<Color>, attributes: Attributes ) -> CompoundStyle
Get an new instance of CompoundStyle
sourcepub fn blend_with<C: Into<Color>>(&mut self, dest: C, weight: f32)
pub fn blend_with<C: Into<Color>>(&mut self, dest: C, weight: f32)
sourcepub fn with_fgbg(fg: Color, bg: Color) -> CompoundStyle
pub fn with_fgbg(fg: Color, bg: Color) -> CompoundStyle
Get an new instance of CompoundStyle
sourcepub fn with_fg(fg: Color) -> CompoundStyle
pub fn with_fg(fg: Color) -> CompoundStyle
Get an new instance of CompoundStyle
sourcepub fn with_bg(bg: Color) -> CompoundStyle
pub fn with_bg(bg: Color) -> CompoundStyle
Get an new instance of CompoundStyle
sourcepub fn with_attr(attr: Attribute) -> CompoundStyle
pub fn with_attr(attr: Attribute) -> CompoundStyle
Get an new instance of CompoundStyle
sourcepub fn remove_attr(&mut self, attr: Attribute)
pub fn remove_attr(&mut self, attr: Attribute)
Remove an Attribute
. Like italic, underlined or bold.
sourcepub fn overwrite_with(&mut self, other: &CompoundStyle)
pub fn overwrite_with(&mut self, other: &CompoundStyle)
Add the defined characteristics of other
to self, overwriting
its own one when defined
pub const fn get_fg(&self) -> Option<Color>
pub const fn get_bg(&self) -> Option<Color>
sourcepub fn repeat_char(
&self,
f: &mut Formatter<'_>,
c: char,
count: usize
) -> Result
pub fn repeat_char( &self, f: &mut Formatter<'_>, c: char, count: usize ) -> Result
Write a char several times with the line compound style
sourcepub fn repeat_string(
&self,
f: &mut Formatter<'_>,
s: &str,
count: usize
) -> Result
pub fn repeat_string( &self, f: &mut Formatter<'_>, s: &str, count: usize ) -> Result
Write a string several times with the line compound style
Implementation Note: performances here are critical
sourcepub fn repeat_space(&self, f: &mut Formatter<'_>, count: usize) -> Result
pub fn repeat_space(&self, f: &mut Formatter<'_>, count: usize) -> Result
Write 0 or more spaces with the line’s compound style
sourcepub fn queue<W, D>(&self, w: &mut W, val: D) -> Result<(), Error>
pub fn queue<W, D>(&self, w: &mut W, val: D) -> Result<(), Error>
write the value with this style on the given writer
sourcepub fn queue_str<W, S: Into<String>>(
&self,
w: &mut W,
s: S
) -> Result<(), Error>where
W: Write,
pub fn queue_str<W, S: Into<String>>(
&self,
w: &mut W,
s: S
) -> Result<(), Error>where
W: Write,
write the string with this style on the given writer
pub fn queue_fg<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
pub fn queue_bg<W>(&self, w: &mut W) -> Result<(), Error>where
W: Write,
sourcepub fn clear<W>(&self, w: &mut W, clear_type: ClearType) -> Result<(), Error>where
W: Write,
pub fn clear<W>(&self, w: &mut W, clear_type: ClearType) -> Result<(), Error>where
W: Write,
Clear with the compound_style’s background.
let mut w = std::io::stderr();
skin.paragraph.compound_style.clear(&mut w, ClearType::UntilNewLine).unwrap();
pub fn style_char(&self, nude_char: char) -> StyledChar
pub fn attrs(&self) -> Attributes
Trait Implementations§
source§impl Clone for CompoundStyle
impl Clone for CompoundStyle
source§fn clone(&self) -> CompoundStyle
fn clone(&self) -> CompoundStyle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more