1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use std::fmt;
use crossterm_style::{Attribute, Color};
use minimad::Alignment;
use crate::compound_style::CompoundStyle;
#[derive(Default)]
pub struct LineStyle {
pub compound_style: CompoundStyle,
pub align: Alignment,
}
impl LineStyle {
#[inline(always)]
pub fn set_fg(&mut self, color: Color) {
self.compound_style.set_fg(color);
}
#[inline(always)]
pub fn set_bg(&mut self, color: Color) {
self.compound_style.set_bg(color);
}
pub fn set_fgbg(&mut self, fg: Color, bg: Color) {
self.compound_style.set_fgbg(fg, bg);
}
#[inline(always)]
pub fn add_attr(&mut self, attr: Attribute) {
self.compound_style.add_attr(attr);
}
#[inline(always)]
pub fn repeat_string(
&self,
f: &mut fmt::Formatter<'_>,
s: &str,
count: usize,
) -> fmt::Result {
self.compound_style.repeat_string(f, s, count)
}
#[inline(always)]
pub fn repeat_space(
&self,
f: &mut fmt::Formatter<'_>,
count: usize,
) -> fmt::Result {
self.repeat_string(f, " ", count)
}
}