Media icons: 3:1 against the button colour macOS actually paints
The play/pause icons on macOS light buttons were about 2.6:1, because native macOS buttons paint #ebebeb on a white window, not the system button-face colour the check used. Check the icons against the button face, the window colour and a shade 20 steps toward the opposite end. They now measure 3.1:1 on the Mac (light and dark checked in real system appearance), and stay above 3:1 on Linux and Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdKQBRg6YCM1XXQCTnD5GF
This commit is contained in:
@@ -1091,8 +1091,13 @@ pub fn build(frame: Widget) -> App {
|
||||
// Play / pause / stop as coloured media icons (green / amber / red). Vivid
|
||||
// fixed colours read well on both light and dark themes.
|
||||
// The icon colours are kept to at least 3:1 against this theme's button
|
||||
// face (the fixed hues alone were about 2:1 on light buttons).
|
||||
let face = [wx_rs::system_color(3)];
|
||||
// face (the fixed hues alone were about 2:1 on light buttons). Native
|
||||
// buttons do not all paint the system button-face colour (macOS draws
|
||||
// #ebebeb on a white window), so also check the window colour and a shade
|
||||
// 20 steps toward the opposite end.
|
||||
let win = wx_rs::system_color(0);
|
||||
let shade = if luminance(win) < 128.0 { 20 } else { -20 };
|
||||
let face = [wx_rs::system_color(3), win, nudge(win, shade)];
|
||||
let icon = |c| readable_at(c, &face, MIN_ICON_CONTRAST);
|
||||
let play_btn = Widget::media_button(panel, ID_PLAY, 0, icon((56, 190, 108)));
|
||||
ctl.add(play_btn, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 2);
|
||||
|
||||
Reference in New Issue
Block a user