tortoise/
style.rs

1use bitflags::bitflags;
2
3#[derive(Debug, PartialEq, Clone)]
4pub struct Style {
5	pub background_color: Color,
6	pub foreground_color: Color,
7	pub style_mask: StyleMask,
8}
9
10#[derive(Clone, Copy, Debug, Eq, PartialEq)]
11pub enum Color {
12	Default,
13	Black,
14	Red,
15	Green,
16	Yellow,
17	Blue,
18	Magenta,
19	Cyan,
20	White,
21	BrightBlack,
22	BrightRed,
23	BrightGreen,
24	BrightYellow,
25	BrightBlue,
26	BrightMagenta,
27	BrightCyan,
28	BrightWhite,
29	Rgb(u8, u8, u8),
30}
31
32bitflags! {
33	pub struct StyleMask: u8 {
34		const NORMAL        = 0b0000_0000;
35		const BOLD          = 0b0000_0001;
36		const FAINT         = 0b0000_0010;
37		const ITALIC        = 0b0000_0100;
38		const UNDERLINE     = 0b0000_1000;
39		const STRIKETHROUGH = 0b0001_0000;
40	}
41}
42
43impl Default for Style {
44	fn default() -> Self {
45		Self {
46			background_color: Color::Default,
47			foreground_color: Color::Default,
48			style_mask: StyleMask::NORMAL,
49		}
50	}
51}