Skip to content

Commit 43ea3b4

Browse files
committed
Add light theme
1 parent 3eb7dd3 commit 43ea3b4

13 files changed

Lines changed: 298 additions & 250 deletions

platforms/shared/desktop/config.cpp

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ void config_read(void)
260260
config_emulator.fullscreen = read_bool("Emulator", "FullScreen", false);
261261
config_emulator.fullscreen_mode = read_int("Emulator", "FullScreenMode", 1);
262262
config_emulator.always_show_menu = read_bool("Emulator", "AlwaysShowMenu", false);
263+
config_emulator.theme = read_int("Emulator", "Theme", config_Theme_Dark);
264+
config_emulator.theme = CLAMP(config_emulator.theme, config_Theme_Light, config_Theme_Dark);
263265
config_emulator.ffwd_speed = read_int("Emulator", "FFWD", 1);
264266
config_emulator.save_slot = read_int("Emulator", "SaveSlot", 0);
265267
config_emulator.start_paused = read_bool("Emulator", "StartPaused", false);
@@ -327,12 +329,18 @@ void config_read(void)
327329
config_video.palette = read_int("Video", "Palette", 0);
328330
config_video.color_correction = read_bool("Video", "ColorCorrection", true);
329331
config_video.sync = read_bool("Video", "Sync", true);
330-
config_video.background_color[0] = read_float("Video", "BackgroundColorR", 0.1f);
331-
config_video.background_color[1] = read_float("Video", "BackgroundColorG", 0.1f);
332-
config_video.background_color[2] = read_float("Video", "BackgroundColorB", 0.1f);
333-
config_video.background_color_debugger[0] = read_float("Video", "BackgroundColorDebuggerR", 0.2f);
334-
config_video.background_color_debugger[1] = read_float("Video", "BackgroundColorDebuggerG", 0.2f);
335-
config_video.background_color_debugger[2] = read_float("Video", "BackgroundColorDebuggerB", 0.2f);
332+
config_video.background_color[config_Theme_Dark][0] = read_float("Video", "BackgroundColorR", 0.1f);
333+
config_video.background_color[config_Theme_Dark][1] = read_float("Video", "BackgroundColorG", 0.1f);
334+
config_video.background_color[config_Theme_Dark][2] = read_float("Video", "BackgroundColorB", 0.1f);
335+
config_video.background_color_debugger[config_Theme_Dark][0] = read_float("Video", "BackgroundColorDebuggerR", 0.2f);
336+
config_video.background_color_debugger[config_Theme_Dark][1] = read_float("Video", "BackgroundColorDebuggerG", 0.2f);
337+
config_video.background_color_debugger[config_Theme_Dark][2] = read_float("Video", "BackgroundColorDebuggerB", 0.2f);
338+
config_video.background_color[config_Theme_Light][0] = read_float("Video", "BackgroundColorLightR", 128.0f / 255.0f);
339+
config_video.background_color[config_Theme_Light][1] = read_float("Video", "BackgroundColorLightG", 128.0f / 255.0f);
340+
config_video.background_color[config_Theme_Light][2] = read_float("Video", "BackgroundColorLightB", 128.0f / 255.0f);
341+
config_video.background_color_debugger[config_Theme_Light][0] = read_float("Video", "BackgroundColorDebuggerLightR", 160.0f / 255.0f);
342+
config_video.background_color_debugger[config_Theme_Light][1] = read_float("Video", "BackgroundColorDebuggerLightG", 160.0f / 255.0f);
343+
config_video.background_color_debugger[config_Theme_Light][2] = read_float("Video", "BackgroundColorDebuggerLightB", 160.0f / 255.0f);
336344

337345
for (int i = 0; i < config_max_custom_palettes; i++)
338346
{
@@ -496,6 +504,7 @@ void config_write(void)
496504
write_bool("Emulator", "FullScreen", config_emulator.fullscreen);
497505
write_int("Emulator", "FullScreenMode", config_emulator.fullscreen_mode);
498506
write_bool("Emulator", "AlwaysShowMenu", config_emulator.always_show_menu);
507+
write_int("Emulator", "Theme", config_emulator.theme);
499508
write_int("Emulator", "FFWD", config_emulator.ffwd_speed);
500509
write_int("Emulator", "SaveSlot", config_emulator.save_slot);
501510
write_bool("Emulator", "StartPaused", config_emulator.start_paused);
@@ -551,12 +560,18 @@ void config_write(void)
551560
write_int("Video", "Palette", config_video.palette);
552561
write_bool("Video", "ColorCorrection", config_video.color_correction);
553562
write_bool("Video", "Sync", config_video.sync);
554-
write_float("Video", "BackgroundColorR", config_video.background_color[0]);
555-
write_float("Video", "BackgroundColorG", config_video.background_color[1]);
556-
write_float("Video", "BackgroundColorB", config_video.background_color[2]);
557-
write_float("Video", "BackgroundColorDebuggerR", config_video.background_color_debugger[0]);
558-
write_float("Video", "BackgroundColorDebuggerG", config_video.background_color_debugger[1]);
559-
write_float("Video", "BackgroundColorDebuggerB", config_video.background_color_debugger[2]);
563+
write_float("Video", "BackgroundColorR", config_video.background_color[config_Theme_Dark][0]);
564+
write_float("Video", "BackgroundColorG", config_video.background_color[config_Theme_Dark][1]);
565+
write_float("Video", "BackgroundColorB", config_video.background_color[config_Theme_Dark][2]);
566+
write_float("Video", "BackgroundColorDebuggerR", config_video.background_color_debugger[config_Theme_Dark][0]);
567+
write_float("Video", "BackgroundColorDebuggerG", config_video.background_color_debugger[config_Theme_Dark][1]);
568+
write_float("Video", "BackgroundColorDebuggerB", config_video.background_color_debugger[config_Theme_Dark][2]);
569+
write_float("Video", "BackgroundColorLightR", config_video.background_color[config_Theme_Light][0]);
570+
write_float("Video", "BackgroundColorLightG", config_video.background_color[config_Theme_Light][1]);
571+
write_float("Video", "BackgroundColorLightB", config_video.background_color[config_Theme_Light][2]);
572+
write_float("Video", "BackgroundColorDebuggerLightR", config_video.background_color_debugger[config_Theme_Light][0]);
573+
write_float("Video", "BackgroundColorDebuggerLightG", config_video.background_color_debugger[config_Theme_Light][1]);
574+
write_float("Video", "BackgroundColorDebuggerLightB", config_video.background_color_debugger[config_Theme_Light][2]);
560575

561576
for (int i = 0; i < config_max_custom_palettes; i++)
562577
{

platforms/shared/desktop/config.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,20 @@ enum config_ShaderMode
4343
config_ShaderMode_External = 1
4444
};
4545

46+
enum config_Theme
47+
{
48+
config_Theme_Light = 0,
49+
config_Theme_Dark = 1,
50+
config_Theme_Count = 2
51+
};
52+
4653
struct config_Emulator
4754
{
4855
bool maximized = false;
4956
bool fullscreen = false;
5057
int fullscreen_mode = 1;
5158
bool always_show_menu = false;
59+
int theme = config_Theme_Dark;
5260
bool paused = false;
5361
int save_slot = 0;
5462
bool start_paused = false;
@@ -109,8 +117,14 @@ struct config_Video
109117
};
110118
bool sync = true;
111119
bool color_correction = true;
112-
float background_color[3] = {0.1f, 0.1f, 0.1f};
113-
float background_color_debugger[3] = {0.2f, 0.2f, 0.2f};
120+
float background_color[config_Theme_Count][3] = {
121+
{128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f},
122+
{0.1f, 0.1f, 0.1f}
123+
};
124+
float background_color_debugger[config_Theme_Count][3] = {
125+
{160.0f / 255.0f, 160.0f / 255.0f, 160.0f / 255.0f},
126+
{0.2f, 0.2f, 0.2f}
127+
};
114128
int shader_mode = config_ShaderMode_PixelPerfect;
115129
std::string shader_preset_path;
116130
};

0 commit comments

Comments
 (0)