Skip to content

Commit 090831e

Browse files
committed
Use colors that work with both light and dark themes
1 parent 4b2f1a5 commit 090831e

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

ronald-egui/src/debug/cpu.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,27 +239,27 @@ impl CpuDebugWindow {
239239
ui.label("IFF1:");
240240
ui.colored_label(
241241
if data.iff1 {
242-
egui::Color32::GREEN
242+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
243243
} else {
244-
egui::Color32::RED
244+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
245245
},
246246
if data.iff1 { "ON" } else { "OFF" },
247247
);
248248
ui.label("IFF2:");
249249
ui.colored_label(
250250
if data.iff2 {
251-
egui::Color32::GREEN
251+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
252252
} else {
253-
egui::Color32::RED
253+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
254254
},
255255
if data.iff2 { "ON" } else { "OFF" },
256256
);
257257
ui.label("Halted:");
258258
ui.colored_label(
259259
if data.halted {
260-
egui::Color32::YELLOW
260+
egui::Color32::from_rgb(200, 150, 0) // Dark yellow/gold - better contrast
261261
} else {
262-
egui::Color32::GREEN
262+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
263263
},
264264
if data.halted { "YES" } else { "NO" },
265265
);
@@ -281,9 +281,9 @@ impl CpuDebugWindow {
281281
let is_set = (flags >> bit) & 1 != 0;
282282
ui.colored_label(
283283
if is_set {
284-
egui::Color32::GREEN
284+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
285285
} else {
286-
egui::Color32::GRAY
286+
egui::Color32::from_gray(120) // Darker gray - better contrast
287287
},
288288
format!("{}: {}", name, if is_set { "1" } else { "0" }),
289289
);

ronald-egui/src/debug/memory.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ impl Default for MemoryDebugWindow {
4646
impl Default for MemorySourceColors {
4747
fn default() -> Self {
4848
Self {
49-
lower_rom: egui::Color32::from_rgb(255, 165, 0), // Orange
50-
upper_rom: egui::Color32::from_rgb(255, 20, 147), // Deep pink
51-
ram: egui::Color32::from_rgb(50, 205, 50), // Lime green
52-
extension_ram: egui::Color32::from_rgb(135, 206, 235), // Sky blue
49+
lower_rom: egui::Color32::from_rgb(255, 140, 0), // Dark orange - good contrast in both themes
50+
upper_rom: egui::Color32::from_rgb(220, 20, 120), // Deep magenta - better contrast than pink
51+
ram: egui::Color32::from_rgb(0, 150, 0), // Forest green - better contrast than lime
52+
extension_ram: egui::Color32::from_rgb(30, 144, 255), // Dodger blue - better contrast than sky blue
5353
}
5454
}
5555
}
@@ -61,16 +61,15 @@ impl MemorySourceColors {
6161
MemoryViewMode::UpperRomOnly(_) => self.upper_rom,
6262
MemoryViewMode::RamOnly => self.ram,
6363
MemoryViewMode::ExtensionRamOnly => self.extension_ram,
64-
_ => egui::Color32::from_gray(200), // Default text color for composite modes and disassembly
64+
_ => egui::Color32::from_gray(160), // Better contrast - darker gray for both themes
6565
}
6666
}
6767
}
6868

6969
impl MemoryDebugWindow {
7070
fn get_memory_source_color(&self, addr: usize, data: &MemoryDebugView) -> egui::Color32 {
71-
// Only apply source-based coloring for composite modes
7271
match &self.view_mode {
73-
MemoryViewMode::CompositeRomRam => {
72+
MemoryViewMode::Disassembly | MemoryViewMode::CompositeRomRam => {
7473
// CPC 464 memory map:
7574
// 0x0000-0x3FFF: Lower ROM (if enabled) or RAM
7675
// 0x4000-0x7FFF: RAM
@@ -248,9 +247,9 @@ impl MemoryDebugWindow {
248247
ui.label("Lower ROM:");
249248
ui.colored_label(
250249
if data.lower_rom_enabled {
251-
egui::Color32::GREEN
250+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
252251
} else {
253-
egui::Color32::RED
252+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
254253
},
255254
if data.lower_rom_enabled {
256255
"ENABLED"
@@ -262,9 +261,9 @@ impl MemoryDebugWindow {
262261
ui.label("Upper ROM:");
263262
ui.colored_label(
264263
if data.upper_rom_enabled {
265-
egui::Color32::GREEN
264+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
266265
} else {
267-
egui::Color32::RED
266+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
268267
},
269268
if data.upper_rom_enabled {
270269
"ENABLED"
@@ -281,9 +280,9 @@ impl MemoryDebugWindow {
281280
ui.label("Lower ROM:");
282281
ui.colored_label(
283282
if data.lower_rom_enabled {
284-
egui::Color32::GREEN
283+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
285284
} else {
286-
egui::Color32::RED
285+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
287286
},
288287
if data.lower_rom_enabled {
289288
"ENABLED"
@@ -299,9 +298,9 @@ impl MemoryDebugWindow {
299298
ui.label("Upper ROM:");
300299
ui.colored_label(
301300
if data.upper_rom_enabled {
302-
egui::Color32::GREEN
301+
egui::Color32::from_rgb(0, 150, 0) // Forest green - better contrast
303302
} else {
304-
egui::Color32::RED
303+
egui::Color32::from_rgb(200, 50, 50) // Dark red - better contrast
305304
},
306305
if data.upper_rom_enabled {
307306
"ENABLED"
@@ -447,7 +446,10 @@ impl MemoryDebugWindow {
447446
let color = if is_current_instruction {
448447
egui::Color32::WHITE
449448
} else {
450-
egui::Color32::YELLOW
449+
self.get_memory_source_color(
450+
instruction.address as usize,
451+
&data.memory,
452+
)
451453
};
452454
ui.colored_label(
453455
color,
@@ -458,7 +460,7 @@ impl MemoryDebugWindow {
458460
let color = if is_current_instruction {
459461
egui::Color32::WHITE
460462
} else {
461-
egui::Color32::LIGHT_BLUE
463+
egui::Color32::from_rgb(70, 130, 180) // Steel blue - better contrast
462464
};
463465
ui.colored_label(color, &instruction.instruction);
464466
});

0 commit comments

Comments
 (0)