Media icons: 3:1 against the button colour macOS actually paints #28
@@ -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