Skip to content

Commit 74bb8df

Browse files
committed
Fix toggle button naming
1 parent 38a2a47 commit 74bb8df

3 files changed

Lines changed: 33 additions & 29 deletions

File tree

‎build.zig.zon‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
22
.name = .engine,
3-
.version = "0.34.0",
3+
.version = "0.35.0",
44
.fingerprint = 0xe8a81a8d0aa558d5,
55
.minimum_zig_version = "0.17.0-dev.1426+58a94eaae",
66
.dependencies = .{

‎src/Button.zig‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,13 @@ inline fn iconColour(entity: *const Entity, theme: *const Theme) Colour {
205205
}
206206
}
207207

208+
/// Apply the button `style` or alternatively the `toggle` button style
209+
/// when toggle mode is enabled.
208210
inline fn buttonColour(entity: *const Entity, theme: *const Theme, texture: *sdl.SDL_Texture) void {
209211
if (entity.type.button.toggle != .no_toggle) {
210212
switch (entity.type.button.toggle) {
211-
.off, .locked_off => Entity.tint_texture(texture, theme.toggle_button),
212-
.on => Entity.tint_texture(texture, theme.toggle_button_picked),
213+
.off, .locked_off => Entity.tint_texture(texture, theme.toggle_button_off),
214+
.on => Entity.tint_texture(texture, theme.toggle_button_on),
213215
.correct => Entity.tint_texture(texture, theme.toggle_button_correct),
214216
.incorrect => Entity.tint_texture(texture, theme.toggle_button_incorrect),
215217
.no_toggle, .disabled => Entity.tint_texture(texture, .white),

‎src/Theme.zig‎

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ tinted_text_colour: Colour,
2626
tinted_panel_colour: Colour,
2727
tinted_button_colour: Colour,
2828

29-
/// Some elements can switch from default background and text colour to
30-
/// an alternate stronger text and background colour.
29+
/// A bold panel where the colours are intended to be inverted versions of the
30+
/// regular panel. i.e. If the normal background is white, this would be black.
3131
emphasised_panel_colour: Colour,
3232
emphasised_text_colour: Colour,
3333
emphasised_button_colour: Colour,
3434

35-
/// Switch from default panel style to a faded/de-emphasised panel style.
35+
/// Switch from default panel style to a faded/de-emphasised version of
36+
/// the normal panel style.
3637
faded_panel_colour: Colour,
3738
faded_text_colour: Colour,
3839
faded_button_colour: Colour,
@@ -48,18 +49,19 @@ failed_text_colour: Colour,
4849
failed_button_colour: Colour,
4950

5051
/// Default background of a button when toggle is enabled.
51-
toggle_button: Colour,
52+
toggle_button_off: Colour,
5253

5354
/// Background of a button when a toggle button is marked picked.
54-
toggle_button_picked: Colour,
55+
toggle_button_on: Colour,
5556

5657
/// Background of a button in toggle mode that has been marked correct.
5758
toggle_button_correct: Colour,
5859

5960
/// Background of a button in toggle mode that has been marked incorrect.
6061
toggle_button_incorrect: Colour,
6162

62-
/// The colour of the progress bar itself. Not the colour of the entity background.
63+
/// The colour of the progress bar itself. Not the colour of
64+
/// the entity background.
6365
progress_bar_background: Colour,
6466

6567
/// The colour of the progress indicator that is overlaid onto the progress bar.
@@ -116,9 +118,9 @@ pub const default_themes = [5]Theme{
116118
.tinted_text_colour = .{ .r = 185, .g = 185, .b = 245, .a = 255 },
117119
.tinted_panel_colour = .{ .r = 255, .g = 205, .b = 205, .a = 128 },
118120
.tinted_button_colour = .{ .r = 255, .g = 205, .b = 205, .a = 128 },
119-
.emphasised_text_colour = .{ .r = 255, .g = 205, .b = 205, .a = 128 },
120-
.emphasised_panel_colour = .{ .r = 255, .g = 205, .b = 205, .a = 128 },
121-
.emphasised_button_colour = .{ .r = 255, .g = 205, .b = 205, .a = 128 },
121+
.emphasised_text_colour = .{ .r = 0, .g = 0, .b = 0, .a = 255 },
122+
.emphasised_panel_colour = .{ .r = 255, .g = 255, .b = 255, .a = 255 },
123+
.emphasised_button_colour = .{ .r = 230, .g = 235, .b = 255, .a = 255 },
122124
.success_text_colour = .{ .r = 255, .g = 255, .b = 255, .a = 255 },
123125
.success_button_colour = .{ .r = 35, .g = 129, .b = 43, .a = 255 },
124126
.success_panel_colour = .{ .r = 83, .g = 172, .b = 75, .a = 128 },
@@ -128,8 +130,8 @@ pub const default_themes = [5]Theme{
128130
.faded_text_colour = .{ .r = 204, .g = 204, .b = 204, .a = 255 },
129131
.faded_panel_colour = .{ .r = 15, .g = 17, .b = 25, .a = 255 },
130132
.faded_button_colour = .{ .r = 35, .g = 37, .b = 45, .a = 255 },
131-
.toggle_button = .{ .r = 42, .g = 52, .b = 62, .a = 255 },
132-
.toggle_button_picked = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
133+
.toggle_button_off = .{ .r = 42, .g = 52, .b = 62, .a = 255 },
134+
.toggle_button_on = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
133135
.toggle_button_correct = .{ .r = 80, .g = 119, .b = 81, .a = 255 },
134136
.toggle_button_incorrect = .{ .r = 119, .g = 80, .b = 80, .a = 255 },
135137
.progress_bar_background = .{ .r = 31, .g = 34, .b = 48, .a = 255 },
@@ -146,9 +148,9 @@ pub const default_themes = [5]Theme{
146148
.tinted_text_colour = .{ .r = 150, .g = 150, .b = 142, .a = 128 },
147149
.tinted_panel_colour = .{ .r = 185, .g = 166, .b = 194, .a = 255 },
148150
.tinted_button_colour = .{ .r = 185, .g = 166, .b = 194, .a = 255 },
149-
.emphasised_text_colour = .{ .r = 185, .g = 166, .b = 194, .a = 255 },
150-
.emphasised_panel_colour = .{ .r = 185, .g = 166, .b = 194, .a = 255 },
151-
.emphasised_button_colour = .{ .r = 185, .g = 166, .b = 194, .a = 255 },
151+
.emphasised_text_colour = .{ .r = 60, .g = 60, .b = 95, .a = 255 },
152+
.emphasised_panel_colour = .{ .r = 235, .g = 245, .b = 255, .a = 255 },
153+
.emphasised_button_colour = .{ .r = 205, .g = 215, .b = 225, .a = 255 },
152154
.success_text_colour = .{ .r = 255, .g = 255, .b = 255, .a = 255 },
153155
.success_button_colour = .{ .r = 35, .g = 129, .b = 43, .a = 255 },
154156
.success_panel_colour = .{ .r = 83, .g = 172, .b = 75, .a = 128 },
@@ -158,8 +160,8 @@ pub const default_themes = [5]Theme{
158160
.faded_text_colour = .{ .r = 156, .g = 156, .b = 156, .a = 255 },
159161
.faded_panel_colour = .{ .r = 36, .g = 46, .b = 56, .a = 255 },
160162
.faded_button_colour = .{ .r = 56, .g = 66, .b = 76, .a = 255 },
161-
.toggle_button = .{ .r = 58, .g = 72, .b = 86, .a = 255 },
162-
.toggle_button_picked = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
163+
.toggle_button_off = .{ .r = 58, .g = 72, .b = 86, .a = 255 },
164+
.toggle_button_on = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
163165
.toggle_button_correct = .{ .r = 80, .g = 119, .b = 81, .a = 255 },
164166
.toggle_button_incorrect = .{ .r = 119, .g = 80, .b = 80, .a = 255 },
165167
.progress_bar_background = .{ .r = 47, .g = 58, .b = 69, .a = 255 },
@@ -189,8 +191,8 @@ pub const default_themes = [5]Theme{
189191
.faded_text_colour = .{ .r = 72, .g = 72, .b = 42, .a = 255 },
190192
.faded_panel_colour = .{ .r = 217, .g = 207, .b = 197, .a = 255 },
191193
.faded_button_colour = .{ .r = 237, .g = 227, .b = 217, .a = 255 },
192-
.toggle_button = .{ .r = 196, .g = 184, .b = 170, .a = 255 },
193-
.toggle_button_picked = .{ .r = 157, .g = 138, .b = 118, .a = 255 },
194+
.toggle_button_off = .{ .r = 196, .g = 184, .b = 170, .a = 255 },
195+
.toggle_button_on = .{ .r = 157, .g = 138, .b = 118, .a = 255 },
194196
.toggle_button_correct = .{ .r = 132, .g = 160, .b = 100, .a = 255 },
195197
.toggle_button_incorrect = .{ .r = 159, .g = 111, .b = 98, .a = 255 },
196198
.progress_bar_background = .{ .r = 210, .g = 200, .b = 190, .a = 255 },
@@ -208,9 +210,9 @@ pub const default_themes = [5]Theme{
208210
.tinted_text_colour = .{ .r = 99, .g = 138, .b = 171, .a = 128 },
209211
.tinted_panel_colour = .{ .r = 40, .g = 0, .b = 0, .a = 128 },
210212
.tinted_button_colour = .{ .r = 40, .g = 0, .b = 0, .a = 128 },
211-
.emphasised_text_colour = .{ .r = 40, .g = 0, .b = 0, .a = 128 },
212-
.emphasised_panel_colour = .{ .r = 40, .g = 0, .b = 0, .a = 128 },
213-
.emphasised_button_colour = .{ .r = 40, .g = 0, .b = 0, .a = 128 },
213+
.emphasised_text_colour = .{ .r = 235, .g = 235, .b = 255, .a = 255 },
214+
.emphasised_panel_colour = .{ .r = 0, .g = 0, .b = 20, .a = 225 },
215+
.emphasised_button_colour = .{ .r = 20, .g = 20, .b = 40, .a = 188 },
214216
.success_text_colour = .{ .r = 255, .g = 255, .b = 255, .a = 255 },
215217
.success_button_colour = .{ .r = 35, .g = 129, .b = 43, .a = 255 },
216218
.success_panel_colour = .{ .r = 83, .g = 172, .b = 75, .a = 128 },
@@ -219,9 +221,9 @@ pub const default_themes = [5]Theme{
219221
.failed_panel_colour = .{ .r = 150, .g = 80, .b = 65, .a = 255 },
220222
.faded_text_colour = .{ .r = 40, .g = 40, .b = 40, .a = 255 },
221223
.faded_panel_colour = .{ .r = 240, .g = 247, .b = 255, .a = 255 },
222-
.faded_button_colour = .{ .r = 220, .g = 227, .b = 235, .a = 255 },
223-
.toggle_button = .{ .r = 193, .g = 203, .b = 213, .a = 255 },
224-
.toggle_button_picked = .{ .r = 131, .g = 142, .b = 149, .a = 255 },
224+
.faded_button_colour = .{ .r = 220, .g = 227, .b = 245, .a = 255 },
225+
.toggle_button_off = .{ .r = 193, .g = 203, .b = 213, .a = 255 },
226+
.toggle_button_on = .{ .r = 131, .g = 142, .b = 149, .a = 255 },
225227
.toggle_button_correct = .{ .r = 132, .g = 160, .b = 100, .a = 255 },
226228
.toggle_button_incorrect = .{ .r = 159, .g = 111, .b = 98, .a = 255 },
227229
.progress_bar_background = .{ .r = 217, .g = 230, .b = 242, .a = 255 },
@@ -250,8 +252,8 @@ pub const default_themes = [5]Theme{
250252
.faded_text_colour = .{ .r = 204, .g = 204, .b = 204, .a = 255 },
251253
.faded_panel_colour = .{ .r = 65, .g = 130, .b = 92, .a = 255 },
252254
.faded_button_colour = .{ .r = 85, .g = 150, .b = 112, .a = 255 },
253-
.toggle_button = .{ .r = 20, .g = 70, .b = 20, .a = 255 },
254-
.toggle_button_picked = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
255+
.toggle_button_off = .{ .r = 20, .g = 70, .b = 20, .a = 255 },
256+
.toggle_button_on = .{ .r = 80, .g = 99, .b = 119, .a = 255 },
255257
.toggle_button_correct = .{ .r = 80, .g = 119, .b = 81, .a = 255 },
256258
.toggle_button_incorrect = .{ .r = 119, .g = 80, .b = 80, .a = 255 },
257259
.progress_bar_background = .{ .r = 86, .g = 150, .b = 114, .a = 255 },

0 commit comments

Comments
 (0)