Skip to main content

color_output/color/
enum.rs

1/// Represents different types of colors that can be used for text formatting.
2#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub enum ColorType {
4    /// RGB color with red, green and blue components.
5    Rgb(u8, u8, u8),
6    /// 256-color palette color.
7    Color256(u32),
8    /// Predefined built-in colors.
9    Use(Color),
10}
11
12/// Specifies whether color applies to text or background.
13#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub(crate) enum DisplayType {
15    /// Color applies to text.
16    #[default]
17    Text,
18    /// Color applies to background.
19    Background,
20}
21
22/// Predefined color constants for easy text formatting.
23#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub enum Color {
25    /// Default terminal color.
26    #[default]
27    Default,
28    /// Black color.
29    Black,
30    /// Red color.
31    Red,
32    /// Green color.
33    Green,
34    /// Yellow color.
35    Yellow,
36    /// Blue color.
37    Blue,
38    /// Magenta color.
39    Magenta,
40    /// Cyan color.
41    Cyan,
42    /// White color.
43    White,
44}