From aab6af1601fa4cdb9b351987220f32de062d4b2c Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 28 Oct 2026 08:42:30 +0100 Subject: 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. --- dist/wipfel/index.html | 2 + dist/wipfel/style.css | 126 ++++++++++++++++++++++++++++++++------------- dist/wipfel/wipfel.js | 32 +++++++++--- dist/wipfel/wipfel_bg.wasm | Bin 518287 -> 519140 bytes 4 files changed, 117 insertions(+), 43 deletions(-) (limited to 'dist/wipfel') diff --git a/dist/wipfel/index.html b/dist/wipfel/index.html index 98f81e8..67d0378 100644 --- a/dist/wipfel/index.html +++ b/dist/wipfel/index.html @@ -3,6 +3,8 @@ + + wipfel — web based gipfel photogrammetry diff --git a/dist/wipfel/style.css b/dist/wipfel/style.css index 3ef48b1..80c4d15 100644 --- a/dist/wipfel/style.css +++ b/dist/wipfel/style.css @@ -1,6 +1,56 @@ * { box-sizing: border-box; } +:root { + /* dark is the default theme; the light block below overrides for + users whose OS/browser prefers light */ + --bg: #101014; + --panel: #1a1a20; + --panel-border: #2c2c34; + --text: #e8e8ea; + --text-dim: #c8c8d0; + --text-faint: #8a8a94; + --input-bg: #24242c; + --input-border: #34343e; + --chip-bg: #2c2c34; + --chip-hover: #3b3b46; + --btn: #3b6fd4; + --btn-hover: #4a7ee4; + --accent: #7fa5e8; + --fitinfo: #9fd09f; + --canvas-bg: #101014; + --compass-bg: rgb(41, 41, 41); + --compass-fg: rgb(217, 217, 217); + --compass-divider: rgb(82, 82, 82); + --popover-bg: #1e1e26; + --popover-border: #3a3a46; + --popover-shadow: rgba(0, 0, 0, 0.5); +} +@media (prefers-color-scheme: light) { + :root { + --bg: #e9eaf0; + --panel: #ffffff; + --panel-border: #d6d8de; + --text: #1e1e26; + --text-dim: #44464e; + --text-faint: #7c7e88; + --input-bg: #f0f1f5; + --input-border: #c9ccd4; + --chip-bg: #e2e3e9; + --chip-hover: #d0d2da; + --btn: #3b6fd4; + --btn-hover: #2f5fbd; + --accent: #2b5cb8; + --fitinfo: #2e7d32; + --canvas-bg: #d9dbe2; + --compass-bg: rgb(240, 241, 245); + --compass-fg: rgb(40, 40, 48); + --compass-divider: rgb(170, 173, 182); + --popover-bg: #ffffff; + --popover-border: #c9ccd4; + --popover-shadow: rgba(40, 40, 60, 0.25); + } +} html, body { margin: 0; @@ -14,14 +64,14 @@ body { area behind the collapsing URL bar, pushing the compass below the fold; dvh tracks the actually visible area */ height: 100dvh; - background: #101014; - color: #e8e8ea; + background: var(--bg); + color: var(--text); } .sidebar { width: 300px; padding: 16px; - background: #1a1a20; - border-right: 1px solid #2c2c34; + background: var(--panel); + border-right: 1px solid var(--panel-border); display: flex; flex-direction: column; gap: 8px; @@ -38,12 +88,13 @@ body { width: 28px; height: 28px; padding: 0; - background: #2c2c34; + background: var(--chip-bg); + color: var(--text); font-size: 12px; border-radius: 5px; } .sidebar .collapse-btn:hover { - background: #3b3b46; + background: var(--chip-hover); } .nav-toggle { position: absolute; @@ -63,6 +114,7 @@ body { .nav-toggle:hover { background: rgba(59, 111, 212, 0.9); } +/* sits on top of the photo, so it stays dark in both themes */ .canvasstatus { position: absolute; bottom: 6px; @@ -89,19 +141,19 @@ body { .tag { display: block; margin: 0 0 12px; - color: #8a8a94; + color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; text-decoration: none; } .tag:hover { - color: #7fa5e8; + color: var(--accent); text-decoration: underline; } .sidebar button { padding: 8px 12px; - background: #3b6fd4; + background: var(--btn); color: #fff; border: 0; border-radius: 6px; @@ -109,16 +161,16 @@ body { cursor: pointer; } .sidebar button:hover { - background: #4a7ee4; + background: var(--btn-hover); } .status { font-size: 13px; - color: #c8c8d0; + color: var(--text-dim); word-break: break-word; } .hint { font-size: 12px; - color: #8a8a94; + color: var(--text-faint); } .row { display: flex; @@ -129,13 +181,13 @@ body { } .fitinfo { font-size: 12px; - color: #9fd09f; + color: var(--fitinfo); font-variant-numeric: tabular-nums; } .hover { font-size: 14px; font-weight: 600; - color: #ffffff; + color: var(--text); } .dim { opacity: 0.6; @@ -143,7 +195,6 @@ body { .hidden-file { display: none; } -/* pin the optional track section to the bottom of the control pane */ .infofoot { /* pins the info texts to the bottom of the sidebar */ margin-top: auto; @@ -158,6 +209,7 @@ body { flex: 1; position: relative; min-height: 0; + background: var(--canvas-bg); } canvas.viewport { position: absolute; @@ -179,8 +231,8 @@ canvas.compass { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; - color: #8a8a94; - border-bottom: 1px solid #2c2c34; + color: var(--text-faint); + border-bottom: 1px solid var(--panel-border); padding-bottom: 3px; } .slider { @@ -193,10 +245,11 @@ canvas.compass { display: flex; justify-content: space-between; font-size: 12px; - color: #c8c8d0; + color: var(--text-dim); } .slider input[type="range"] { width: 100%; + accent-color: var(--btn); } .numrow { display: flex; @@ -209,9 +262,9 @@ canvas.compass { .numrow input { width: 130px; padding: 4px 6px; - background: #24242c; - color: #e8e8ea; - border: 1px solid #34343e; + background: var(--input-bg); + color: var(--text); + border: 1px solid var(--input-border); border-radius: 4px; } .numrow input[type="text"] { @@ -226,24 +279,24 @@ canvas.compass { position: absolute; z-index: 10; width: 280px; - background: #1e1e26; - border: 1px solid #3a3a46; + background: var(--popover-bg); + border: 1px solid var(--popover-border); border-radius: 6px; - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); + box-shadow: 0 8px 24px var(--popover-shadow); display: flex; flex-direction: column; } .fpsearch { padding: 8px; - border-bottom: 1px solid #2c2c34; + border-bottom: 1px solid var(--panel-border); } .fpsearch input { width: 100%; padding: 5px 8px; - background: #24242c; - border: 1px solid #3a3a46; + background: var(--input-bg); + border: 1px solid var(--popover-border); border-radius: 4px; - color: #e8e8ea; + color: var(--text); font-size: 13px; } .fplist { @@ -253,18 +306,18 @@ canvas.compass { .fpempty { padding: 8px 10px; font-size: 13px; - color: #8a8a94; + color: var(--text-faint); margin: 0; } .fpfoot { padding: 6px 8px; - border-top: 1px solid #2c2c34; + border-top: 1px solid var(--panel-border); text-align: right; } .fpcancel { padding: 4px 12px; - background: #34343e; - color: #e8e8ea; + background: var(--chip-bg); + color: var(--text); border: 0; border-radius: 4px; font-size: 12px; @@ -275,8 +328,8 @@ canvas.compass { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; - color: #8a8a94; - border-bottom: 1px solid #2c2c34; + color: var(--text-faint); + border-bottom: 1px solid var(--panel-border); } .fpitem { display: block; @@ -285,10 +338,11 @@ canvas.compass { padding: 6px 10px; background: none; border: 0; - color: #e8e8ea; + color: var(--text); font-size: 13px; cursor: pointer; } .fpitem:hover { - background: #2f6fd4; + background: var(--btn); + color: #fff; } diff --git a/dist/wipfel/wipfel.js b/dist/wipfel/wipfel.js index a3a8c29..b27047b 100644 --- a/dist/wipfel/wipfel.js +++ b/dist/wipfel/wipfel.js @@ -81,6 +81,9 @@ function __wbg_get_imports() { const ret = arg0.childNodes; return ret; }, + __wbg_clearRect_a5e36505218c247a: function(arg0, arg1, arg2, arg3, arg4) { + arg0.clearRect(arg1, arg2, arg3, arg4); + }, __wbg_click_d990e70c576b7c54: function(arg0) { arg0.click(); }, @@ -139,6 +142,10 @@ function __wbg_get_imports() { const ret = arg0.devicePixelRatio; return ret; }, + __wbg_documentElement_3f718a9a39a893d3: function(arg0) { + const ret = arg0.documentElement; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, __wbg_document_9854e03c05fc8834: function(arg0) { const ret = arg0.document; return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); @@ -194,10 +201,21 @@ function __wbg_get_imports() { const ret = arg0.getBoundingClientRect(); return ret; }, + __wbg_getComputedStyle_dd0f456804795fd6: function() { return handleError(function (arg0, arg1) { + const ret = arg0.getComputedStyle(arg1); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, __wbg_getContext_635e36719cad2623: function() { return handleError(function (arg0, arg1, arg2) { const ret = arg0.getContext(getStringFromWasm0(arg1, arg2)); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); }, arguments); }, + __wbg_getPropertyValue_e90a3628c2de4fb6: function() { return handleError(function (arg0, arg1, arg2, arg3) { + const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, arguments); }, __wbg_get_6c896e0571ddae51: function(arg0, arg1) { const ret = arg0[arg1 >>> 0]; return ret; @@ -606,12 +624,12 @@ function __wbg_get_imports() { }, __wbindgen_generic_0000000000000002: function(arg0, arg1) { // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array"), NamedExternref("ResizeObserver")], shim_idx: 72, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. - const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_); + const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_fd3e5a073eeae266___features__gen_ResizeObserver__ResizeObserver______true_); return ret; }, __wbindgen_generic_0000000000000003: function(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Ref(NamedExternref("Event"))], shim_idx: 90, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. - const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_); + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Ref(NamedExternref("Event"))], shim_idx: 92, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. + const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_fd3e5a073eeae266___features__gen_Event__Event______true_); return ret; }, __wbindgen_generic_0000000000000004: function(arg0, arg1) { @@ -644,8 +662,8 @@ function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true_(arg0, arg1); } -function wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_(arg0, arg1, arg2) { - wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_(arg0, arg1, arg2); +function wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_fd3e5a073eeae266___features__gen_Event__Event______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_fd3e5a073eeae266___features__gen_Event__Event______true_(arg0, arg1, arg2); } function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___wasm_bindgen_f1f668f83a5f514b___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_f1f668f83a5f514b___JsError___true_(arg0, arg1, arg2) { @@ -659,8 +677,8 @@ function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_3 wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined_______true_(arg0, arg1, arg2, arg3); } -function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3) { - wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3); +function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_fd3e5a073eeae266___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_fd3e5a073eeae266___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3); } function addToExternrefTable0(obj) { diff --git a/dist/wipfel/wipfel_bg.wasm b/dist/wipfel/wipfel_bg.wasm index c3a3096..3f5974a 100644 Binary files a/dist/wipfel/wipfel_bg.wasm and b/dist/wipfel/wipfel_bg.wasm differ -- cgit v1.2.3