makepad_draw/text/
color.rs1#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
2pub struct Color {
3 pub r: u8,
4 pub g: u8,
5 pub b: u8,
6 pub a: u8,
7}
8
9impl Color {
10 pub const BLACK: Self = Self::new(0, 0, 0, 255);
11 pub const RED: Self = Self::new(128, 0, 0, 255);
12 pub const GREEN: Self = Self::new(0, 128, 0, 255);
13 pub const YELLOW: Self = Self::new(128, 128, 0, 255);
14 pub const BLUE: Self = Self::new(0, 0, 128, 255);
15 pub const MAGENTA: Self = Self::new(128, 0, 128, 255);
16 pub const CYAN: Self = Self::new(0, 128, 128, 255);
17 pub const WHITE: Self = Self::new(192, 192, 192, 255);
18 pub const BRIGHT_BLACK: Self = Self::new(128, 128, 128, 255);
19 pub const BRIGHT_RED: Self = Self::new(255, 0, 0, 255);
20 pub const BRIGHT_GREEN: Self = Self::new(0, 255, 0, 255);
21 pub const BRIGHT_YELLOW: Self = Self::new(255, 255, 0, 255);
22 pub const BRIGHT_BLUE: Self = Self::new(0, 0, 255, 255);
23 pub const BRIGHT_MAGENTA: Self = Self::new(255, 0, 255, 255);
24 pub const BRIGHT_CYAN: Self = Self::new(0, 255, 255, 255);
25 pub const BRIGHT_WHITE: Self = Self::new(255, 255, 255, 255);
26
27 pub const fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
28 Self { r, g, b, a }
29 }
30}