crossterm/style/
content_style.rs1use std::fmt::Display;
4
5use crate::style::{Attributes, Color, StyledContent};
6
7#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
9pub struct ContentStyle {
10 pub foreground_color: Option<Color>,
12 pub background_color: Option<Color>,
14 pub underline_color: Option<Color>,
16 pub attributes: Attributes,
18}
19
20impl ContentStyle {
21 #[inline]
23 pub fn apply<D: Display>(self, val: D) -> StyledContent<D> {
24 StyledContent::new(self, val)
25 }
26
27 #[inline]
29 pub fn new() -> ContentStyle {
30 ContentStyle::default()
31 }
32}
33
34impl AsRef<ContentStyle> for ContentStyle {
35 fn as_ref(&self) -> &Self {
36 self
37 }
38}
39impl AsMut<ContentStyle> for ContentStyle {
40 fn as_mut(&mut self) -> &mut Self {
41 self
42 }
43}