diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-28 08:42:30 +0100 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2026-10-28 08:42:30 +0100 |
| commit | aab6af1601fa4cdb9b351987220f32de062d4b2c (patch) | |
| tree | e5d2b4b6af7e5d8fd8d19717786ed0f29b619b0f /crates/wipfel/src/canvas_view.rs | |
| parent | d57f022243850b532239ae08dd75717f55415fbf (diff) | |
web: follow system light/dark preference
All colors moved into CSS custom properties on :root (dark default)
with a prefers-color-scheme: light override block. The two canvas-
drawn surfaces follow too: the viewport now clears transparent so the
CSS canvas background shows through, and the compass strip reads its
colors from the same variables via a new bridge::css_var helper.
theme-color metas (dark + light variants) tint mobile browser chrome
to match.
Diffstat (limited to 'crates/wipfel/src/canvas_view.rs')
| -rw-r--r-- | crates/wipfel/src/canvas_view.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crates/wipfel/src/canvas_view.rs b/crates/wipfel/src/canvas_view.rs index c5777e3..df46b5c 100644 --- a/crates/wipfel/src/canvas_view.rs +++ b/crates/wipfel/src/canvas_view.rs @@ -156,10 +156,9 @@ pub fn canvas_view(props: &Props) -> Html { canvas.set_height(bh); } let _ = ctx.set_transform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - // web-sys 0.3: set_fill_style takes a JsValue (deprecated alias) - #[allow(deprecated)] - ctx.set_fill_style(&wasm_bindgen::JsValue::from_str("#101014")); - ctx.fill_rect(0.0, 0.0, canvas.width() as f64, canvas.height() as f64); + // transparent clear: the CSS background of .canvaswrap + // (a theme variable) shows through + ctx.clear_rect(0.0, 0.0, canvas.width() as f64, canvas.height() as f64); let Some(bitmap) = bitmap else { return }; let _ = ctx.set_transform( dpr * view.scale, |
