kutil_cli/debug/
theme.rs

1use owo_colors::*;
2
3//
4// Theme
5//
6
7/// Collection of theme for printing text.
8///
9/// See [Debuggable](super::debuggable::Debuggable).
10pub struct Theme {
11    /// For bare words: true, false, null, etc.
12    pub bare: Style,
13
14    /// For numbers.
15    pub number: Style,
16
17    /// For strings and characters.
18    pub string: Style,
19
20    /// For names of types, instances, etc.
21    pub name: Style,
22
23    /// For metadata.
24    pub meta: Style,
25
26    /// For errors.
27    pub error: Style,
28
29    /// For headings.
30    pub heading: Style,
31
32    /// For delimiters.
33    pub delimiter: Style,
34}
35
36impl Theme {
37    /// Plain theme.
38    pub fn plain() -> Self {
39        Self {
40            bare: Style::new(),
41            number: Style::new(),
42            string: Style::new(),
43            name: Style::new(),
44            meta: Style::new(),
45            error: Style::new(),
46            heading: Style::new(),
47            delimiter: Style::new(),
48        }
49    }
50}
51
52impl Default for Theme {
53    fn default() -> Self {
54        Self {
55            bare: Style::new().yellow(),
56            number: Style::new().magenta(),
57            string: Style::new().cyan(),
58            name: Style::new().green(),
59            meta: Style::new().blue().italic(),
60            error: Style::new().red().bold(),
61            heading: Style::new().green().bold().underline(),
62            delimiter: Style::new().dimmed(),
63        }
64    }
65}