1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#[derive(Copy, Clone)]
pub struct Color {
pub data: u32,
}
impl Color {
pub fn rgb(r: u8, g: u8, b: u8) -> Self {
Color { data: 0xFF000000 | ((r as u32) << 16) | ((g as u32) << 8) | (b as u32) }
}
pub fn rgba(r: u8, g: u8, b: u8, a: u8) -> Self {
Color { data: ((a as u32) << 24) | ((r as u32) << 16) | ((g as u32) << 8) | (b as u32) }
}
pub const BLACK: Color = Color { data: 0xFF000000 };
pub const BLUE: Color = Color { data: 0xFF0000FF };
pub const GREEN: Color = Color { data: 0xFF00FF00 };
pub const RED: Color = Color { data: 0xFFFF0000 };
pub const WHITE: Color = Color { data: 0xFFFFFFFF };
}