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>where
D: Clone + Display,
pub fn apply_to<D>(&self, val: D) -> StyledContent<D>where D: Clone + Display,
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_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>where
D: Clone + Display,
W: Write,
pub fn queue<W, D>(&self, w: &mut W, val: D) -> Result<(), Error>where D: Clone + Display, W: Write,
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
Trait Implementations§
source§impl Clone for CompoundStyle
impl Clone for CompoundStyle
source§fn clone(&self) -> CompoundStyle
fn clone(&self) -> CompoundStyle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Returns the “default value” for a type. Read more
source§impl From<ContentStyle> for CompoundStyle
impl From<ContentStyle> for CompoundStyle
source§fn from(object_style: ContentStyle) -> CompoundStyle
fn from(object_style: ContentStyle) -> CompoundStyle
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for CompoundStyle
impl Send for CompoundStyle
impl Sync for CompoundStyle
impl Unpin for CompoundStyle
impl UnwindSafe for CompoundStyle
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