From e62eb90dc74dd9daed119415cd6c44c20c85bcd3 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 30 Nov 2026 20:00:38 +0100 Subject: [PATCH] Palettes after IHO S-52 (Day / Dusk / Night, the same tokens, data-palette on ): night dim with low blue and no white areas, the speed limit sign dimmed too; the dashboard light with dark values by day again (the slider fades it instead of whitening it), the dark bezel for dusk and night --- TODO.adoc | 9 +++- docs/design.adoc | 45 ++++++++++++++++--- public/css/style.css | 105 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 135 insertions(+), 24 deletions(-) diff --git a/TODO.adoc b/TODO.adoc index 3f32191..871da5c 100644 --- a/TODO.adoc +++ b/TODO.adoc @@ -289,8 +289,13 @@ Planning in the NPS look, driving in the cockpit look, joined by the Unigrid bla with the driving mode's big-button UI . [ ] The PDM switch panel in the cockpit style (tiles: `--inst-ok` on, muted off, `--inst-warning` fault) -. [ ] Night: instruments dimmed (brightness) on top of the inverted UI; daylight: a full-opacity - bezel preset for sun on the screen +. [x] Palettes after IHO S-52: the same tokens in Day / Dusk / Night (`data-palette` on + ``), night dim with low blue and no white areas, the speed limit sign dimmed too +. [ ] Switch them: by the sun (the night mode's auto) and by hand (the topbar button cycles + day / dusk / night / auto), replacing the inverting `html.night`; the planning UI's + hard-coded colors onto `--ui-*` first, or a dark palette leaves light panels +. [ ] A Dusk map (between Park Tiles and `NightMap`), the map's palette following the UI's +. [ ] Daylight: a full-opacity bezel preset for sun on the screen === HW integration diff --git a/docs/design.adoc b/docs/design.adoc index fc8a6a3..509132a 100644 --- a/docs/design.adoc +++ b/docs/design.adoc @@ -56,10 +56,40 @@ a color never decorates. |=== Road signs stay road signs: the speed limit is the white disc with the -red ring whatever the theme — it's read as a sign, not as a color. +red ring — read as a sign, not as a color (`--sign-*`, only dimmed by +night). -Night: the page's night mode inverts the UI (`html.night`); the -instruments are already dark and are inverted back, only dimmed. +=== Day, dusk, night (after IHO S-52) + +Marine electronic charts (ECDIS) have the most worked-out rules for one +display across bright sun and a dark bridge — the IHO's S-52 (Edition +6.1.1, 2015): *three colour tables, Day, Dusk and Night*, every color a +named token with a value per table (the Presentation Library's Appendix +A). We do the same: the tokens above, three sets of values, `` (Day the default), meanings unchanged between +them. From S-52: + +* *Day*: a light background with dark foreground details, strong contrast — + bright sun washes a display out. (Our instruments keep their dark bezel, + a full-opacity one for sun on the screen.) +* *Dusk*: a black-background table, "for optional use by day as well as at + twilight". +* *Night*: dark background, light foreground, dim enough not to impair night + vision; at low light colors are hard to tell apart, so important things + get a second cue (shape, line style), not color alone. Adjust by + contrast, not brightness (dark colors drop to black). +* Anything added on the chart's screen (panels, text) "should never generate + more light than the chart display itself" at night, and text panels + mustn't outshine the chart. + +Our night values are roughly a third of Day's luminance, warm greys, blue +kept low; no white areas (the speed limit sign dims too). The map has its +own night palette (`NightMap`, `map_themes.js`); a Dusk map is still to do. + +Today the page's night mode inverts the whole UI (`html.night`, the +instruments inverted back). The palettes replace that: set the +`data-palette`, by the sun (already worked out for the night mode) or by +hand. == Typography @@ -82,5 +112,10 @@ route panel, NPS maps, the offline data panel (next maneuver, lanes), the switch panel (PDM), warnings, `/can.html` |=== -The route line is the bridge: blue (`#1d6fdc`) while planning, magenta -(`--inst-active`) once it's being navigated. +The route line is the bridge: blue (`--route-planned`) while planning, +magenta (`--route-active`) once it's being navigated. + +Sources: IHO S-52 Edition 6.1.1 (2015), sections 2.2.6, 4.2; the avionics +color meanings are the common glass-cockpit convention (FAA AC 25-11B has +the color coding guidance, §5.3 — not checked here, its PDF refused the +fetch). diff --git a/public/css/style.css b/public/css/style.css index 16e5d12..39984d8 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,18 +1,89 @@ /* The UI accent (active items, selected options, primary buttons), from the base map's Park Tiles palette: NPS boundary olive on a light sage. */ +/* Palettes after IHO S-52's colour tables (docs/design.adoc): the same + tokens, three sets of values — Day (light ground, strong contrast against + bright sun), Dusk (dark ground, also by day), Night (dark, dim, little + blue: nothing brighter than the map). + switches; Day is the default. Meanings never change between them. */ :root { + /* planning UI (NPS) */ + --ui-bg: #ffffff; + --ui-fg: #1a1a1a; + --ui-muted: #6b6b66; + --ui-line: #d9d6cc; --accent: #546619; --accent-bg: #e1e5cf; /* The Unigrid black band (topbar) — also the instruments' bezel. */ --band: #1a1a1a; - /* Instruments (the driving view), one meaning per color — docs/design.adoc. */ - --inst-text: #f2f2f2; - --inst-muted: #9aa0a6; - --inst-ok: #3ccf4e; - --inst-caution: #ffb300; - --inst-warning: #ff3b30; - --inst-active: #e040fb; /* magenta: the route / waypoint / lane being followed */ - --inst-selected: #00d5ff; /* cyan: a value set by hand */ + --band-fg: #ffffff; + /* Instruments (the driving view), one meaning per color. Day: a light + card with dark values, as S-52's Day table (bright sun); the slider + fades the card, the values stay. */ + --inst-bezel: 255 255 255; /* rgb, the card's opacity applied */ + --inst-halo: #ffffff; /* the outline that keeps values readable over the map */ + --inst-text: #1a1a1a; + --inst-muted: #5f6368; + --inst-ok: #1e8e3e; + --inst-caution: #b36b00; + --inst-warning: #d93025; + --inst-active: #a21caf; /* magenta: the route / waypoint / lane being followed */ + --inst-selected: #00799a; /* cyan: a value set by hand */ + --route-planned: #1d6fdc; + --route-active: var(--inst-active); + /* road signs: still the sign (white disc, red ring), dimmed by night */ + --sign-bg: #ffffff; + --sign-ring: #d32f2f; + --sign-fg: #111111; +} + +:root[data-palette="dusk"] { + --ui-bg: #1f201d; + --ui-fg: #dedbd0; + --ui-muted: #9b988d; + --ui-line: #3a3a35; + --accent: #a5b84f; + --accent-bg: #353b20; + --band: #0f0f0e; + --band-fg: #dedbd0; + --inst-bezel: 15 15 14; + --inst-halo: #000000; + --inst-text: #e2dfd5; + --inst-muted: #8c8a82; + --inst-ok: #34b545; + --inst-caution: #e8a200; + --inst-warning: #ec3a2f; + --inst-active: #cc45e0; + --inst-selected: #12bedf; + --route-planned: #3f86e0; + --sign-bg: #e4e1d6; + --sign-ring: #c42b26; +} + +/* Night: about a third of Day's luminance, warm greys, blue kept low; the + UI never brighter than the map (S-52: added panels "should never + generate more light than the chart display itself"). */ +:root[data-palette="night"] { + --ui-bg: #0c0c0b; + --ui-fg: #8f8b80; + --ui-muted: #5f5c55; + --ui-line: #24231f; + --accent: #6e7c32; + --accent-bg: #1d2113; + --band: #000000; + --band-fg: #8f8b80; + --inst-bezel: 0 0 0; + --inst-halo: #000000; + --inst-text: #a29d90; + --inst-muted: #5f5c55; + --inst-ok: #2a8a33; + --inst-caution: #a87400; + --inst-warning: #ad2a20; + --inst-active: #94339f; + --inst-selected: #137a8c; + --route-planned: #2a5a99; + --sign-bg: #6b675e; + --sign-ring: #8a231b; + --sign-fg: #0c0c0b; } html, body { @@ -3320,14 +3391,14 @@ html.night .maplibregl-marker { z-index: 3; padding: 8px; border-radius: 12px; - background: rgb(26 26 26 / var(--dash-alpha, 0.45)); + background: rgb(var(--inst-bezel) / var(--dash-alpha, 0.45)); backdrop-filter: blur(2px); box-shadow: 0 1px 6px rgb(0 0 0 / calc(var(--dash-alpha, 0.45) * 0.6)); color: var(--inst-text); text-align: center; pointer-events: none; /* readable over a light map whatever the bezel's opacity */ - text-shadow: 0 0 3px #000, 0 0 3px #000; + text-shadow: 0 0 3px var(--inst-halo), 0 0 3px var(--inst-halo); font-family: system-ui, sans-serif; } @@ -3337,8 +3408,8 @@ html.night .maplibregl-marker { height: 190px; } -.dash-incl text { text-anchor: middle; dominant-baseline: middle; fill: var(--inst-text); paint-order: stroke; stroke: #000; stroke-width: 3px; } -.dash-face { fill: rgb(0 0 0 / calc(var(--dash-alpha, 0.45) * 0.5)); stroke: var(--inst-muted); stroke-width: 2; } +.dash-incl text { text-anchor: middle; dominant-baseline: middle; fill: var(--inst-text); paint-order: stroke; stroke: var(--inst-halo); stroke-width: 3px; } +.dash-face { fill: rgb(var(--inst-bezel) / calc(var(--dash-alpha, 0.45) * 0.6)); stroke: var(--inst-muted); stroke-width: 2; } .dash-ring line { stroke: var(--inst-muted); stroke-width: 2; } .dash-ring text { font-size: 14px; font-weight: 600; } .dash-ring .dash-n { fill: var(--inst-warning); } @@ -3360,13 +3431,13 @@ html.night .maplibregl-marker { /* a road sign stays a road sign: white disc, red ring, black figures */ .dash-limit { display: inline-flex; align-items: center; justify-content: center; flex: none; - width: 56px; height: 56px; box-sizing: border-box; border: 7px solid #d32f2f; border-radius: 50%; - background: #fff; color: #111; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: none; + width: 56px; height: 56px; box-sizing: border-box; border: 7px solid var(--sign-ring); border-radius: 50%; + background: var(--sign-bg); color: var(--sign-fg); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: none; } .dash-limit[hidden] { display: none; } .dash-limit--small { width: 26px; height: 26px; border-width: 3px; font-size: 11px; vertical-align: middle; } /* no limit (Autobahn): the white sign with the black slash */ -.dash-limit--none { border: 2px solid #111; background: linear-gradient(135deg, transparent 45%, #111 45% 55%, transparent 55%), #fff; } +.dash-limit--none { border: 2px solid var(--sign-fg); background: linear-gradient(135deg, transparent 45%, var(--sign-fg) 45% 55%, transparent 55%), var(--sign-bg); } .dash-ahead > div { margin: 2px 0; white-space: nowrap; } .dash-maneuver { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--inst-active); } .dash-signal { @@ -3377,11 +3448,11 @@ html.night .maplibregl-marker { .dash-lanes { display: flex; gap: 3px; } .dash-card--over { box-shadow: 0 0 0 4px var(--inst-warning), 0 1px 6px rgba(0, 0, 0, 0.25); } .dash-card--over .dash-speed span { color: var(--inst-warning); } -.dash-lanes svg.dash-lane { width: 26px; height: 34px; border-radius: 4px; background: rgb(0 0 0 / 0.45); border: 1px solid var(--inst-muted); box-sizing: border-box; } +.dash-lanes svg.dash-lane { width: 26px; height: 34px; border-radius: 4px; background: rgb(var(--inst-bezel) / 0.7); border: 1px solid var(--inst-muted); box-sizing: border-box; } .dash-lane__arrow { fill: none; stroke: var(--inst-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } .dash-lane--go { border-color: var(--inst-active) !important; } .dash-lane--go .dash-lane__arrow { stroke: var(--inst-text); } -.dash-lane--go .dash-lane__take { stroke: var(--inst-active); stroke-width: 3; } +.dash-lane--go .dash-lane__take { stroke: var(--inst-active); stroke-width: 3.5; } .dash-offroute { color: var(--inst-caution); font-weight: 600; } /* The GNSS position once it has a course: an arrow, not the dot. */ .gnss-marker--arrow { width: 26px; height: 26px; border: none; border-radius: 0; background: none; box-shadow: none; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5)); }