color_output/color/struct.rs
1use crate::*;
2
3/// Provides utilities for calculating and ensuring color contrast ratios.
4///
5/// Used to determine if text colors meet WCAG accessibility standards
6/// when displayed on specific background colors.
7#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
8pub struct ColorContrast;
9
10/// Represents a colored text output with formatting options.
11#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct ColorOutput<'a> {
13 /// The text content to output.
14 pub text: &'a str,
15 /// The text color.
16 pub color: ColorType,
17 /// The background color.
18 pub bg_color: ColorType,
19 /// Whether the text should be bold.
20 pub bold: bool,
21 /// Whether to add a newline after the text.
22 pub endl: bool,
23}
24
25/// Builder pattern for constructing ColorOutput configurations.
26#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct ColorOutputBuilder<'a> {
28 /// The ColorOutput configuration being built.
29 pub output: ColorOutput<'a>,
30}
31
32/// Represents a list of ColorOutput configurations for sequential execution.
33#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct ColorOutputList<'a>(
35 /// Collection of ColorOutput configurations to execute in sequence
36 pub Vec<ColorOutput<'a>>,
37);
38
39/// Builder pattern for constructing ColorOutputList configurations.
40#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
41pub struct ColorOutputListBuilder<'a> {
42 /// Collection of ColorOutput configurations being built.
43 pub output_list: Vec<ColorOutput<'a>>,
44}