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
use bitflags::bitflags;

#[derive(Debug, PartialEq, Clone)]
pub struct Style {
	pub background_color: Color,
	pub foreground_color: Color,
	pub style_mask: StyleMask,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Color {
	Default,
	Black,
	Red,
	Green,
	Yellow,
	Blue,
	Magenta,
	Cyan,
	White,
	BrightBlack,
	BrightRed,
	BrightGreen,
	BrightYellow,
	BrightBlue,
	BrightMagenta,
	BrightCyan,
	BrightWhite,
	Rgb(u8, u8, u8),
}

bitflags! {
	pub struct StyleMask: u8 {
		const NORMAL        = 0b0000_0000;
		const BOLD          = 0b0000_0001;
		const FAINT         = 0b0000_0010;
		const ITALIC        = 0b0000_0100;
		const UNDERLINE     = 0b0000_1000;
		const STRIKETHROUGH = 0b0001_0000;
	}
}

impl Default for Style {
	fn default() -> Self {
		Self {
			background_color: Color::Default,
			foreground_color: Color::Default,
			style_mask: StyleMask::NORMAL,
		}
	}
}