| author | |
| committer | |
| log | d179e57e9d023e275f399908164444480b498def |
| tree | a8df7b6d4f5c1b49d1a2bef72ec3acb47fe3fce6 |
| parent | 96eb01ef499be1bd5ba4792a1ae2191ad42bdf2d |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU (~clover) |
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-sol3 files changed, 20 insertions(+), 19 deletions(-)
arc/platforms.md+6-7| ... | ... | @@ -146,13 +146,12 @@ keyboard, the toolbar and the macOS menu bar all run commands from it. |
| 146 | 146 | and 10, whose frames are opaque, the window has no system frame and the |
| 147 | 147 | row draws and runs caption buttons as 10 does, over acrylic on 10. Over |
| 148 | 148 | 7's glass, which takes any colour and whatever lies behind the window, |
| 149 | the toolbar keeps opaque faces under its icons: by default the strip is | |
| 150 | opaque, as Explorer's command bar is under its glass, stopping short of the | |
| 151 | caption buttons 7 draws beneath the window's pixels, and | |
| 152 | `SNOWBOUND_W7_CHROME` tries the alternatives, `pills` for a face per group | |
| 153 | of tools over the glass, `frost` for a strip the glass tints through, and | |
| 154 | `tint` and `tint-tiles` for one panel or a tile per group in the glass's | |
| 155 | colour at a lightness text keeps its contrast on, as Mica tints. | |
| 149 | the toolbar gathers its tools on a panel in the glass's colour, fading from | |
| 150 | 80% to 90% opacity behind opaque icons. Its lightness keeps text legible | |
| 151 | even over a bright desktop in the dark theme. | |
| 152 | `SNOWBOUND_W7_CHROME` tries the alternatives: `bar` for an opaque strip, | |
| 153 | `pills` for an opaque face per group, `frost` for a translucent strip, | |
| 154 | and `tint-tiles` for a tinted face per group instead of one panel. | |
| 156 | 155 | The theme and material follow the system's colour mode as it changes. |
| 157 | 156 | With Windows 7's basic or classic theme the system draws the title bar |
| 158 | 157 | and the row lies beneath it, as on KDE. |
crates/snowbound/src/main.rs+5| ... | ... | @@ -6142,6 +6142,11 @@ fn tool_face(theme: &Theme, shown: bool, rise: f32) -> Spec<'static> { |
| 6142 | 6142 | } |
| 6143 | 6143 | Spec { |
| 6144 | 6144 | fill: Some(theme.tool), |
| 6145 | gradient: (theme.tool[3] < 1.0).then(|| { | |
| 6146 | let mut bottom = theme.tool; | |
| 6147 | bottom[3] = (bottom[3] + 0.1).min(1.0); | |
| 6148 | bottom | |
| 6149 | }), | |
| 6145 | 6150 | border: Some(theme.chip), |
| 6146 | 6151 | radius: 4.0, |
| 6147 | 6152 | inset: [0.0, -rise, 0.0, -rise], |
crates/snowbound/src/windows.rs+9-12| ... | ... | @@ -725,17 +725,13 @@ pub fn titlebar(appearance: Theme) -> Option<[[f32; 4]; 2]> { |
| 725 | 725 | }) |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | /// The theme over the window's material. Aero glass takes whatever lies behind the window | |
| 729 | /// and any colour the user picks, so on Windows 7 the toolbar keeps opaque faces under its | |
| 730 | /// icons, as `SNOWBOUND_W7_CHROME` picks: `bar`, Explorer's opaque command bar under the glass | |
| 731 | /// frame; `pills`, a face per group of tools over the glass; `frost`, the strip see-through | |
| 732 | /// enough to tint it; or `tint`, one panel of tools in the glass's colour, and `tint-tiles`, | |
| 733 | /// a tile per group. | |
| 728 | /// The theme over the window's material, with a tinted translucent toolbar over Aero. | |
| 734 | 729 | pub fn over_backdrop(theme: ui::Theme, appearance: Theme) -> ui::Theme { |
| 735 | 730 | if version() >= (6, 2, 0) { |
| 736 | 731 | return theme.over_backdrop(); |
| 737 | 732 | } |
| 738 | 733 | match std::env::var("SNOWBOUND_W7_CHROME").as_deref() { |
| 734 | Ok("bar") => theme, | |
| 739 | 735 | Ok("pills") => ui::Theme { |
| 740 | 736 | strip: [0.0; 4], |
| 741 | 737 | tool: theme.base, |
| ... | ... | @@ -745,14 +741,13 @@ pub fn over_backdrop(theme: ui::Theme, appearance: Theme) -> ui::Theme { |
| 745 | 741 | strip: [theme.strip[0], theme.strip[1], theme.strip[2], 0.85], |
| 746 | 742 | ..theme |
| 747 | 743 | }, |
| 748 | Ok(chrome @ ("tint" | "tint-tiles")) => ui::Theme { | |
| 744 | chrome => ui::Theme { | |
| 749 | 745 | strip: [0.0; 4], |
| 750 | 746 | tool: glass_tint(appearance == Theme::Dark), |
| 751 | tool_panel: chrome == "tint", | |
| 747 | tool_panel: chrome != Ok("tint-tiles"), | |
| 752 | 748 | chip: [0.0, 0.0, 0.0, 0.35], |
| 753 | 749 | ..theme |
| 754 | 750 | }, |
| 755 | _ => theme, | |
| 756 | 751 | } |
| 757 | 752 | } |
| 758 | 753 | |
| ... | ... | @@ -770,11 +765,13 @@ fn glass_tint(dark: bool) -> [f32; 4] { |
| 770 | 765 | (high - low) / 255.0 / (1.0 - (2.0 * lightness - 1.0).abs()) |
| 771 | 766 | }; |
| 772 | 767 | let strength = 0.85 * (0.6 + 0.4 * f32::from(intensity) / 255.0); |
| 773 | draw::hsl( | |
| 768 | let mut tint = draw::hsl( | |
| 774 | 769 | draw::hue(draw::srgb(red, green, blue)), |
| 775 | 770 | saturation * strength, |
| 776 | if dark { 0.22 } else { 0.84 }, | |
| 777 | ) | |
| 771 | if dark { 0.12 } else { 0.84 }, | |
| 772 | ); | |
| 773 | tint[3] = 0.8; | |
| 774 | tint | |
| 778 | 775 | } |
| 779 | 776 | |
| 780 | 777 | /// None: the kit's own menus. |