Skip to content

Commit 670f58e

Browse files
Zetenypappclaude
andcommitted
Themes: High Contrast check boxes and slider rails keep the text at 7:1 when hovered or pressed
The hovered and pressed fills (#666/#7A7A7A dark, #9C9C9C/#888 light) put the text below the 7:1 High Contrast target; they now step away from the text colour instead. The accent outline still marks hover and press. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 17dbfed commit 670f58e

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎crates/ui-egui/src/theme.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ impl Tokens {
289289
field_bg: Color32::BLACK,
290290
text_field: Color32::BLACK,
291291
control: Color32::from_gray(0x50),
292-
control_hover: Color32::from_gray(0x66),
293-
control_pressed: Color32::from_gray(0x7A),
292+
control_hover: Color32::from_gray(0x3C),
293+
control_pressed: Color32::from_gray(0x28),
294294
shadow: Color32::TRANSPARENT,
295295
}
296296
} else {
@@ -321,8 +321,8 @@ impl Tokens {
321321
field_bg: Color32::WHITE,
322322
text_field: Color32::WHITE,
323323
control: Color32::from_gray(0xB0),
324-
control_hover: Color32::from_gray(0x9C),
325-
control_pressed: Color32::from_gray(0x88),
324+
control_hover: Color32::from_gray(0xC8),
325+
control_pressed: Color32::from_gray(0xDC),
326326
shadow: Color32::TRANSPARENT,
327327
}
328328
}
@@ -620,6 +620,10 @@ mod tests {
620620
assert!(contrast(t.text, bg) >= 7.0, "dark={dark}: {:.2}:1", contrast(t.text, bg));
621621
}
622622
assert!(contrast(t.accent_text, t.accent) >= 7.0);
623+
// Check boxes, slider rails and their hovered and pressed fills carry the text at 7:1.
624+
for (name, fill) in [("control", t.control), ("hovered", t.control_hover), ("pressed", t.control_pressed)] {
625+
assert!(contrast(t.text, fill) >= 7.0, "dark={dark}: text on the {name} control is {:.2}:1", contrast(t.text, fill));
626+
}
623627
assert!(contrast(t.border, t.chrome) >= 7.0, "outlines stand out");
624628
assert!(contrast(t.text_faint, t.chrome) >= 4.5, "even disabled text is legible");
625629
}

0 commit comments

Comments
 (0)