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
mod colors;
mod parser;
mod writer;
#[derive(Clone, Copy, PartialEq, Debug)]
#[allow(missing_docs)]
pub struct Color {
pub red: u8,
pub green: u8,
pub blue: u8,
}
impl Color {
pub fn new(red: u8, green: u8, blue: u8) -> Color {
Color { red, green, blue }
}
pub fn black() -> Color {
Color::new(0, 0, 0)
}
pub fn white() -> Color {
Color::new(255, 255, 255)
}
pub fn gray() -> Color {
Color::new(128, 128, 128)
}
pub fn red() -> Color {
Color::new(255, 0, 0)
}
pub fn green() -> Color {
Color::new(0, 128, 0)
}
pub fn blue() -> Color {
Color::new(0, 0, 255)
}
}