pub struct Style {
pub fg: Option<Color>,
pub bg: Option<Color>,
pub attributes: Attributes,
}Expand description
The style for a cell in a [crate::Buffer]
A style is applied to ever single cell in a [crate::Buffer].
Styles do not cascade (and don’t behave like CSS). So giving a style to a parent widget does not automatically apply it to the child.
The following template would draw a red border with white text inside:
border [foreground: red]:
text: "hi"In the following example, if the condition is ever true, and then false the text is_false
will be rendered with a red foreground.
The way to reset the foreground is to apply Color::Reset to the text.
if [cond: {{ is_true }}]:
text [foreground: red]: "is true"
else:
text: "is false"Fields§
§fg: Option<Color>Foreground colour.
bg: Option<Color>Background colour.
attributes: AttributesAttributes.
Implementations§
Source§impl Style
impl Style
Sourcepub fn from_cell_attribs(attributes: &Attributes<'_>) -> Self
pub fn from_cell_attribs(attributes: &Attributes<'_>) -> Self
Create an instance of Style from CellAttributes.
Sourcepub fn set_italic(&mut self, italic: bool)
pub fn set_italic(&mut self, italic: bool)
Set the style to italic
Sourcepub fn set_underlined(&mut self, underlined: bool)
pub fn set_underlined(&mut self, underlined: bool)
Make the cell underlined as long as it’s supported
Sourcepub fn set_overlined(&mut self, overlined: bool)
pub fn set_overlined(&mut self, overlined: bool)
Make the cell overlined as long as it’s supported
Sourcepub fn set_crossed_out(&mut self, crossed_out: bool)
pub fn set_crossed_out(&mut self, crossed_out: bool)
Make the cell crossed out as long as it’s supported
Sourcepub fn set_reversed(&mut self, inverse: bool)
pub fn set_reversed(&mut self, inverse: bool)
Invert the foreground and background