From d179e57e9d023e275f399908164444480b498def Mon Sep 17 00:00:00 2001 From: clover caruso Date: Sun, 11 Oct 2026 12:54:33 -0700 Subject: [PATCH] fix: tint the Windows 7 toolbar over Aero glass Derive the toolbar panel from the system glass color with an 80% to 90% opacity fade behind opaque controls. Deepen the dark tint to preserve foreground contrast over bright backgrounds. Keep the previous toolbar variants available for comparison. Refs #66 Assisted-by: gpt-6.1-sol --- arc/platforms.md | 13 ++++++------- crates/snowbound/src/main.rs | 5 +++++ crates/snowbound/src/windows.rs | 21 +++++++++------------ 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/arc/platforms.md b/arc/platforms.md index 78648855a9dc8ebda02796972f0777fc79da3356..a9c8efa79b23ee24b5521338c355a6921fe7984e 100644 --- a/arc/platforms.md +++ b/arc/platforms.md @@ -146,13 +146,12 @@ keyboard, the toolbar and the macOS menu bar all run commands from it. and 10, whose frames are opaque, the window has no system frame and the row draws and runs caption buttons as 10 does, over acrylic on 10. Over 7's glass, which takes any colour and whatever lies behind the window, - the toolbar keeps opaque faces under its icons: by default the strip is - opaque, as Explorer's command bar is under its glass, stopping short of the - caption buttons 7 draws beneath the window's pixels, and - `SNOWBOUND_W7_CHROME` tries the alternatives, `pills` for a face per group - of tools over the glass, `frost` for a strip the glass tints through, and - `tint` and `tint-tiles` for one panel or a tile per group in the glass's - colour at a lightness text keeps its contrast on, as Mica tints. + the toolbar gathers its tools on a panel in the glass's colour, fading from + 80% to 90% opacity behind opaque icons. Its lightness keeps text legible + even over a bright desktop in the dark theme. + `SNOWBOUND_W7_CHROME` tries the alternatives: `bar` for an opaque strip, + `pills` for an opaque face per group, `frost` for a translucent strip, + and `tint-tiles` for a tinted face per group instead of one panel. The theme and material follow the system's colour mode as it changes. With Windows 7's basic or classic theme the system draws the title bar and the row lies beneath it, as on KDE. diff --git a/crates/snowbound/src/main.rs b/crates/snowbound/src/main.rs index 0835e09af34e797830a9441293350732d379fbe4..0a70c368bc141d260a68e01a2c3663a9e2ba9873 100644 --- a/crates/snowbound/src/main.rs +++ b/crates/snowbound/src/main.rs @@ -6142,6 +6142,11 @@ fn tool_face(theme: &Theme, shown: bool, rise: f32) -> Spec<'static> { } Spec { fill: Some(theme.tool), + gradient: (theme.tool[3] < 1.0).then(|| { + let mut bottom = theme.tool; + bottom[3] = (bottom[3] + 0.1).min(1.0); + bottom + }), border: Some(theme.chip), radius: 4.0, inset: [0.0, -rise, 0.0, -rise], diff --git a/crates/snowbound/src/windows.rs b/crates/snowbound/src/windows.rs index f82d2da6b6ca640fac307da38da3590772e315d6..31207459d1e884ea7e1c588f7395c86db719a026 100644 --- a/crates/snowbound/src/windows.rs +++ b/crates/snowbound/src/windows.rs @@ -725,17 +725,13 @@ pub fn titlebar(appearance: Theme) -> Option<[[f32; 4]; 2]> { }) } -/// The theme over the window's material. Aero glass takes whatever lies behind the window -/// and any colour the user picks, so on Windows 7 the toolbar keeps opaque faces under its -/// icons, as `SNOWBOUND_W7_CHROME` picks: `bar`, Explorer's opaque command bar under the glass -/// frame; `pills`, a face per group of tools over the glass; `frost`, the strip see-through -/// enough to tint it; or `tint`, one panel of tools in the glass's colour, and `tint-tiles`, -/// a tile per group. +/// The theme over the window's material, with a tinted translucent toolbar over Aero. pub fn over_backdrop(theme: ui::Theme, appearance: Theme) -> ui::Theme { if version() >= (6, 2, 0) { return theme.over_backdrop(); } match std::env::var("SNOWBOUND_W7_CHROME").as_deref() { + Ok("bar") => theme, Ok("pills") => ui::Theme { strip: [0.0; 4], tool: theme.base, @@ -745,14 +741,13 @@ pub fn over_backdrop(theme: ui::Theme, appearance: Theme) -> ui::Theme { strip: [theme.strip[0], theme.strip[1], theme.strip[2], 0.85], ..theme }, - Ok(chrome @ ("tint" | "tint-tiles")) => ui::Theme { + chrome => ui::Theme { strip: [0.0; 4], tool: glass_tint(appearance == Theme::Dark), - tool_panel: chrome == "tint", + tool_panel: chrome != Ok("tint-tiles"), chip: [0.0, 0.0, 0.0, 0.35], ..theme }, - _ => theme, } } @@ -770,11 +765,13 @@ fn glass_tint(dark: bool) -> [f32; 4] { (high - low) / 255.0 / (1.0 - (2.0 * lightness - 1.0).abs()) }; let strength = 0.85 * (0.6 + 0.4 * f32::from(intensity) / 255.0); - draw::hsl( + let mut tint = draw::hsl( draw::hue(draw::srgb(red, green, blue)), saturation * strength, - if dark { 0.22 } else { 0.84 }, - ) + if dark { 0.12 } else { 0.84 }, + ); + tint[3] = 0.8; + tint } /// None: the kit's own menus. -- 2.54.0