1use ggez::graphics::Color;
4
5use crate::{NUM_COLORS, NUM_PIECES};
6
7pub const THEME_DUST: Theme = Theme {
9 background_color: Color::new(0.09, 0.09, 0.11, 1.0),
10 board_color: [
11 Color::new(0.7969, 0.7148, 0.6797, 1.0),
12 Color::new(0.4375, 0.3984, 0.4648, 1.0),
13 ],
14 piece_path: [
15 [
16 "/images/pieces/white_pawn.png",
17 "/images/pieces/white_knight.png",
18 "/images/pieces/white_bishop.png",
19 "/images/pieces/white_rook.png",
20 "/images/pieces/white_queen.png",
21 "/images/pieces/white_king.png",
22 ],
23 [
24 "/images/pieces/black_pawn.png",
25 "/images/pieces/black_knight.png",
26 "/images/pieces/black_bishop.png",
27 "/images/pieces/black_rook.png",
28 "/images/pieces/black_queen.png",
29 "/images/pieces/black_king.png",
30 ],
31 ],
32 valid_moves_color: Some(Color::new(0.25, 0.75, 0.25, 0.5)),
33 piece_pinned_color: Some(Color::new(0.75, 0.25, 0.25, 0.5)),
34 piece_pinned_path: Some("/images/pin.png"),
35 theme_icon_path: Some("/images/theme_icon_white.png"),
36 font_path: "/fonts/LiberationMono-Regular.ttf",
37 font_scale: 20.0,
38};
39
40pub const THEME_CORAL: Theme = Theme {
42 board_color: [
43 Color::new(177.0 / 256.0, 228.0 / 256.0, 185.0 / 256.0, 1.0),
44 Color::new(112.0 / 256.0, 162.0 / 256.0, 163.0 / 256.0, 1.0),
45 ],
46 ..THEME_DUST
47};
48
49pub const THEME_MARINE: Theme = Theme {
51 board_color: [
52 Color::new(157.0 / 256.0, 172.0 / 256.0, 255.0 / 256.0, 1.0),
53 Color::new(111.0 / 256.0, 115.0 / 256.0, 210.0 / 256.0, 1.0),
54 ],
55 ..THEME_DUST
56};
57
58pub const THEME_WHEAT: Theme = Theme {
60 board_color: [
61 Color::new(234.0 / 256.0, 240.0 / 256.0, 206.0 / 256.0, 1.0),
62 Color::new(187.0 / 256.0, 190.0 / 256.0, 100.0 / 256.0, 1.0),
63 ],
64 ..THEME_DUST
65};
66
67pub const THEME_EMERALD: Theme = Theme {
69 board_color: [
70 Color::new(173.0 / 256.0, 189.0 / 256.0, 143.0 / 256.0, 1.0),
71 Color::new(111.0 / 256.0, 143.0 / 256.0, 114.0 / 256.0, 1.0),
72 ],
73 ..THEME_DUST
74};
75
76pub const THEME_SANDCASTLE: Theme = Theme {
78 board_color: [
79 Color::new(227.0 / 256.0, 193.0 / 256.0, 111.0 / 256.0, 1.0),
80 Color::new(184.0 / 256.0, 139.0 / 256.0, 74.0 / 256.0, 1.0),
81 ],
82 ..THEME_DUST
83};
84
85pub(crate) static mut INDEX_THEME: usize = 0;
87
88pub const NUM_THEMES: usize = 6;
90
91pub const THEMES: [Theme; NUM_THEMES] = [
93 THEME_DUST,
94 THEME_CORAL,
95 THEME_MARINE,
96 THEME_WHEAT,
97 THEME_EMERALD,
98 THEME_SANDCASTLE,
99];
100
101#[derive(Copy, Clone, PartialEq, Debug)]
116pub struct Theme {
117 pub background_color: Color,
118 pub board_color: [Color; NUM_COLORS],
119 pub piece_path: [[&'static str; NUM_PIECES]; NUM_COLORS],
120 pub valid_moves_color: Option<Color>,
121 pub piece_pinned_color: Option<Color>,
122 pub piece_pinned_path: Option<&'static str>,
123 pub theme_icon_path: Option<&'static str>,
124 pub font_path: &'static str,
125 pub font_scale: f32,
126}
127
128impl Default for Theme {
129 fn default() -> Self {
130 THEME_DUST
131 }
132}