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
) -> Self
pub const fn new( foreground_color: Option<Color>, background_color: Option<Color>, attributes: Attributes ) -> Self
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)
Blend the foreground and background colors (if any) into the given dest color,
with a weight in [0..1]
.
The dest
color can be for example a [crossterm] color or a coolor one.
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: &Self)
pub fn overwrite_with(&mut self, other: &Self)
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 moresource§impl Debug for CompoundStyle
impl Debug for CompoundStyle
source§impl Default for CompoundStyle
impl Default for CompoundStyle
source§fn default() -> CompoundStyle
fn default() -> CompoundStyle
source§impl<'de> Deserialize<'de> for CompoundStyle
impl<'de> Deserialize<'de> for CompoundStyle
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl From<&[StyleToken]> for CompoundStyle
impl From<&[StyleToken]> for CompoundStyle
source§fn from(tokens: &[StyleToken]) -> Self
fn from(tokens: &[StyleToken]) -> Self
source§impl From<CompoundStyle> for LineStyle
impl From<CompoundStyle> for LineStyle
source§fn from(compound_style: CompoundStyle) -> Self
fn from(compound_style: CompoundStyle) -> Self
source§impl From<ContentStyle> for CompoundStyle
impl From<ContentStyle> for CompoundStyle
source§fn from(object_style: ContentStyle) -> Self
fn from(object_style: ContentStyle) -> Self
source§impl PartialEq for CompoundStyle
impl PartialEq for CompoundStyle
source§fn eq(&self, other: &CompoundStyle) -> bool
fn eq(&self, other: &CompoundStyle) -> bool
self
and other
values to be equal, and is used
by ==
.