cube_core/utils/
cube_utils.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum Color {
3 White,
4 Yellow,
5 Blue,
6 Red,
7 Green,
8 Orange,
9 Gray,
10 Black,
11}
12
13impl Color {
14 pub fn to_ansi(&self) -> &str {
15 match self {
16 Color::White => "\x1b[97m",
17 Color::Yellow => "\x1b[93m",
18 Color::Blue => "\x1b[94m",
19 Color::Red => "\x1b[91m",
20 Color::Green => "\x1b[92m",
21 Color::Orange => "\x1b[38;5;208m",
22 Color::Gray => "\x1b[90m",
23 Color::Black => panic!()
24 }
25 }
26
27 pub fn rgba(&self) -> [u8; 4] {
28 match self {
29 Color::White => [235, 235, 235, 0xff],
30 Color::Yellow => [239, 249, 102, 0xff],
31 Color::Blue => [74, 150, 221, 0xff],
32 Color::Red => [249, 44, 59, 0xff],
33 Color::Green => [118, 242, 139, 0xff],
34 Color::Orange => [254, 146, 43, 0xff],
35 Color::Gray => [160, 152, 160, 0xff],
36 Color::Black => [35, 32, 47, 0xff],
37 }
38 }
39}
40
41#[derive(Debug, PartialEq, Eq, Clone)]
42pub enum Axis {
43 X,
44 Y,
45 Z,
46}