Repository navigation
feat(ui): legible brand colours, previewed live from SahajCloud - #392
Conversation
A service's brand colours could make the atlas hard to use: a pin that vanished into the basemap, a selected pin that matched every other pin, pale text and chips. Our own default secondary and contrast already failed one check, and the default primary failed another. The map edge no longer depends on the brand colour at all. Every pin, bubble, ring and dot carries a fixed outline for the style it is drawn on, measured once from each Studio style's own JSON — dark on the light map, pale on the dark one, because the dark style is mid-toned and its land is lighter than its water. A pin keeps exactly the colour a service chose. The ladder then corrects each role until it passes three checks, for every embed: `panel-text` and `surface` inside `buildScale`, where one seed decides them, and `selected-distinct` in `buildPalette`, which is the only entry point that sees two roles at once. The paint, the map and the report all come through that one call, so they cannot disagree. `DEFAULT_SEEDS` is retuned where a seed could fix the failure, and `globals.css` is regenerated from the corrected ladder. Raises the eager-payload budget to 334 KiB. `colord/plugins/lab` is the cost: `selected-distinct` is a colour-versus-colour measure the a11y plugin cannot make, and every embed owes that check. The credentialed pair is cleared by about 1.6 KiB. The standalone page can now take unsaved colours from a SahajCloud `clients` live preview and answer with what it rendered. Nothing of that enters the embed's import graph. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVKFZaNEE4JgBvahah
A rendered step 9 is a quantisation of the HSL the ladder works in, so feeding that hex back can land a point the other side of a check and be corrected again — offering a volunteer a suggestion that would change their colour a second time the moment they accepted it. `settledSeed` walks to a seed that renders itself, stepping one point further where two candidates render each other. Zero of ~37k swept seeds fail to settle. The stock marker art is per-basemap now, so an unbranded embed holds eight cache entries rather than four and its first theme switch decodes instead of answering warm. Three comments and the mapbox rule said the opposite. The `clients` preview session also retains four bitmaps per palette for the life of the tab, which is a `shortcut:` with a trigger rather than an eviction policy nobody has measured a need for. `docs/embedding.md` and the changelog said a host's colour reaches the map exactly as stored. The pins are painted from the corrected colour like everything else; what the fixed outline buys is that nothing about the colour depends on the basemap. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVKFZaNEE4JgBvahah
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVKFZaNEE4JgBvahah
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
#383 and this branch each added an entry at the head of CHANGELOG's Unreleased § Changed, so git saw an add/add there. Both entries stay, #392 above #349, which keeps the section newest-first. Nothing else overlapped: `docs/embedding.md` and `docs/testing.md` took both sides' new sections cleanly, and the code main brought touches `Widget.tsx`, which this branch never opens. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZVTLRdTmG2ijYEpfj
|
Merged
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 9626bc6 | Nov 12 2026, 05:29 PM |
|
This draft has had no CI activity for hours and no session holds it. A mention ( 🤖 sydevs dispatcher |
|
@sydevs-bot continue work on this PR |
|
Nothing to build here: no review, no open thread, and the branch meets #389 as written. Checked. Merged current Why this PR has not moved. CI run 43095574552 is Your call:
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff traces to #389 section by section, and nothing is built the ticket did not ask for. The one structural claim it made — that the paint, the map and the report all come through buildPalette, so they cannot disagree — holds in the code. Contracts are handled: embedding.md and CHANGELOG.md both move, no origin, CSP or parameter changes, and SahajCloud's mirrored ATLAS_DEFAULT_COLORS feeds only a picker fallback and the Install tab, so the window before the third PR lands is a stale swatch, not a drift in what visitors see. The three findings are all in the map art and the one correction path no spec reaches.
Findings
- should-fix — the bubble's outline renders at 71% alpha and misses the 3:1 bar it was measured for.
markers.ts:126 - consider —
separateSolid's fallback can leave step 9 failingsurface.palette.ts:311 - consider — the pin's stroke is clipped where the bubble's was inset.
markers.ts:113
What was checked
Read whole on the branch: palette.ts, markers.ts, layers.ts, clients.ts, main.tsx, markers.test.ts, markers.outline.test.ts, palette.test.ts, clients.test.ts. Ladder walk on each new piece — scaleHex is stepHex for an already-built scale, @payloadcms/live-preview is the platform's own ready and was already transitive, and clients.ts's hand-rolled listener is §5 of the ticket verbatim, so none is a finding. Consumer side read: SahajCloud src/lib/clients/appearance.ts, Clients.ts:665, InstallGuide.tsx:153. Recomputed the retuned defaults against white — secondary 3.14:1, contrast 3.22:1 — and the outline composites above. No preview link is published yet and this repo seeds none, so nothing was opened.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`opacity` composites the whole element, so the ring's translucency took its own outline with it: white at 0.706 over the dark style's land reaches about 2.6:1, under the 3:1 the outline was measured for. `fill-opacity` leaves the stroke opaque and the ring as translucent as before. `markers.outline.test.ts` held the constant, not the art, so the gap was invisible to it. It now reads the rendered art back and refuses an element carrying both a stroke and an element-wide opacity. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVzCc9EAx2R6ULZgA1
`separateSolid`'s fallback maximised ΔE alone, so where no candidate cleared both bars it could leave `contrast` step 9 under 3:1 against the app surface — a check every role owes in both modes. It now searches only the lightnesses that pass, and gives up the separation alone. No colour moves today: over 274,799 primary/contrast/mode combinations the built scales are byte-identical, the fallback fires 11,476 times and never once in light mode, and its worst surface ratio is 4.98. So there is no reachable defect for a new spec to fail against, and `legibility` already holds the property the fallback can now only satisfy. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVzCc9EAx2R6ULZgA1
The note read 0.6 user units — the stroke's half-width, which is how far it reaches past the path, not past the canvas — beside a device-pixel figure derived from a different number. The canvas clips 0.1 user units at the head's left edge and 0.2 at the rounded tip. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVzCc9EAx2R6ULZgA1
|
Three adversarial findings, all built. Merged current
Lean gate The queued CI run I asked you about is moot. This push is a new head, so a fresh run starts on it. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…de palette report (#399) * fix(ui): tone down a near-white brand colour on the dark map - Dark mode caps the brand solid at lightness 80, as light mode caps it at 70: white passes `surface` on the dark page, so a near-white seed rendered near-white, and three pale seeds gave pins nobody could tell apart - The cap is reported to SahajCloud as a new `near-white` check, so the Atlas tab can say why a colour moved - `selected-distinct` keeps its full dark range, past the cap: same-hue seeds need the room to separate Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): stronger near-white cap on the dark map, per-mode report, softer pin outline - Dark mode's near-white cap drops from lightness 80 to 65: at 80 the pins still read as tints - The palette report adds `lightAdjustedBy` and `darkAdjustedBy` beside the `adjustedBy` union, so SahajCloud can say which mode moved a colour - Pin and cluster outlines draw at half strength (`stroke-opacity`, never element `opacity`); the pale edge then reaches about 2:1 on the dark style's land, accepted for a softer edge Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(ui): report each mode's checks alone, without the union SahajCloud's Atlas tab is the report's one reader, and it now reads lightAdjustedBy and darkAdjustedBy. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): one tone band per mode for the brand solid - `TONE_RANGE` holds step 9 per mode: light 20–70, dark 60. The edge facing the canvas is today's (70 on white, 60 on dark), so our own defaults render unchanged - The far edge is new: a near-black seed is floored at 20 on the light map (`near-black`), and a near-white one capped at 60 on the dark map (`near-white`); only these are reported - `selected-distinct` keeps its room past the far edge Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): a colour cleared in the SahajCloud preview shows the default The preview sends `null` for a colour the manager reset, and `BrandTheme` read it with `??`, so the map fell back to the saved colour — Reset left the map on exactly the colours it was meant to undo. Only `undefined` falls through to the client record now. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(map): ringed pins, outline-free bubbles, light-mode marker colours - A cluster bubble loses its black or white outline; its translucent ring is the whole edge - A pin gains a ring of the bubble's kind (ring colour, 0.706 opacity), 2.2 wide outside the head, drawn behind it; the head shrinks to 0.86 about the tip to fit it in the same 34×38 box - Pins, bubbles, the cluster count and the vague ring and dot take `MARKER_MODE`, the light-mode palette, in both modes: the dark basemap is washed out, and a solid lifted for the dark panel washed out with it - `markerColors`, `markerImages`, `registerMarkerImages` and `clusterLayer` no longer take a mode; the art is the same in both, so a theme switch answers from a warm cache Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): limit the brand solid on the canvas side only - Light mode caps step 9 at 70 and dark mode floors it at 60, as before this branch; the far-side limits (light 20, dark 60) are gone, and with them the `near-white` and `near-black` checks - What prompted them, pale brands washing out on the dark map, is the marks' problem, and `MARKER_MODE` already answers it: pins and bubbles take the light-mode shade, which the 70 cap keeps coloured Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): paint a near-colourless brand as chosen, with tints that match it - Only `#000000`, SahajCloud's old "unconfigured" sentinel, falls back to the default; a grey, white or near-white seed is painted as the neutral ramp it is, where it used to snap to our teal - The ramp's saturation is also held to twice the seed's chroma: HSL calls `#fffdfa` 100% saturated, so its chips and icons came out vivid tan while its solid stayed near-white; mid-toned brands, the three defaults included, are unchanged - `docs/rules/mapbox.md` now describes the ringed pins, the outline-free bubbles and `MARKER_MODE` Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(ui): paint every brand colour with a hue at 60% saturation - `MIN_SATURATION` joins `MAX_SATURATION`, both 60: a vivid seed is toned down as before, and a muted, pale or near-white one is lifted until it reads as a colour; a seed with no hue stays neutral - Whether a seed needs lifting is read from its chroma, since HSL calls `#fffdfa` 100% saturated; a lift past 10 points is reported as `saturation`, so our own teal, two points under, raises no banner - `globals.css`'s frozen defaults are regenerated: the default teal moves 58% → 60% and the default blue 40% → 60% Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ui): a 40% saturation floor that shows in both modes - `MIN_SATURATION` drops to 40, so our three defaults sit inside the band and render exactly as before; `globals.css` is back to its frozen values - A hued solid is also kept far enough from white and black for the floor to show: a near-white seed lifted to the floor still rendered near-white on the dark page, where the canvas-side limit left it alone. That move is reported as `saturation` in the mode it happens in Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(ui): keep the brand solid 20 from the far extreme in each mode `FAR_MARGIN` floors step 9 at 20 on the light map and caps it at 80 on the dark one, reported as `near-black` and `near-white`; the canvas-side limits (70, 60) are unchanged, and `selected-distinct` keeps its room past the margin. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(ui): light-mode solid floor 10, dark-mode floor 50 The tone band is now light 10–70 and dark 50–80. The dark floor moves from 60 to 50, so `globals.css`'s frozen dark defaults are regenerated: the default teal's solid goes 60 → 50 and the blue's 60 → 55. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Revert "feat(ui): light-mode solid floor 10, dark-mode floor 50" This reverts commit e4c99cc91c7565318da4a740cc2f7dd790a7a369. * feat(ui): raise the lightest brand solid by 10 in both modes The tone band is light 20–80 and dark 60–90. Our defaults sit inside both and render unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(theme): report a band crossing independently of the lift A solid pushed past the mode's far edge earned `near-white` or `near-black` only when no `saturation` lift had already been reported, so `NOTICEABLE_LIFT` — a constant about lift size — decided whether a tone move was named at all. `#fffdfa` and `#ffd6d6` both land at dark lightness 75 from past 90; only the first said so. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVNtqqiPXb7PTjfCiT * refactor(theme): read chroma off colord, drop the dead saturation guard `chromaOf` re-derived from HSL what `toHsv()` already carries: `s * v / 100` is the same quantity on the same scale. And `Math.max(MIN_SATURATION, MAX_SATURATION)` is `MAX_SATURATION` for two module constants, so the guard could not fire and read as if the two could invert. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVNtqqiPXb7PTjfCiT * refactor(map): name the four marks' colour pair MarkColors The type covers both pins since they gained rings, and a pin's ring is not a cluster bubble's. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVNtqqiPXb7PTjfCiT * docs(embedding): bring the brand-colour section up to what the map paints Four claims the colour changes broke: the map taking both palettes, an unset colour meaning any colourless one, lightness as the only axis adjusted, and a fixed per-basemap outline on every mark. CHANGELOG gains the #399 references its two new entries were missing, and #392's outline entry says it is superseded for pins and bubbles. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVNtqqiPXb7PTjfCiT * docs(theme): say why PALETTE_CHECKS still skips the basemap Pins and bubbles no longer carry a fixed per-basemap outline, so the reason given for having no basemap check named something that is gone. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVNtqqiPXb7PTjfCiT --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Change outline
Behaviour — the ladder, and what moves in it
buildScalekept its signature; a role is now corrected until it passes, and a third check compares two roles, so it cannot live in there.buildRole(seed, mode) ← was buildScale's whole body saturation = min(s, 60) l9 = mode === 'dark' ? max(l, 60) : min(l, 70) + l9 = correct(l9) until contrast(l9, --background) >= 3 'surface' + l11 = correct(ladder[11]) until contrast(l11, steps 1..3) >= 4.5 'panel-text' l10 = l9 ± 6 on = black or white, by WCAG, computed AFTER the correction + → { scale, adjustedBy } + buildPalette(palette, mode) ← the only caller that sees two roles + each role → buildRole + contrast step 9 vs primary step 9 + ΔE2000 < 20 → separateSolid: nearest lightness in the mode's whole range + that clears 20 AND still passes `surface` 'selected-distinct' + none → the furthest apart the range reaches THAT STILL PASSES `surface` + (the dark-mode trade #388 accepted) + paletteReport(palette) ← both modes, through buildPalette + per role { entered, light, dark, suggested, adjustedBy } + suggested = a seed that RENDERS ITSELF, or null where only `panel-text` movedapplyPalette,markerColorsandpaletteReportall come throughbuildPalette, so the paint, the map and the report cannot disagree.Contract — the map art
No brand colour is measured against the basemap any more.
⚠ Dark edge on the light map, pale edge on the dark one. The dark style is mid-toned and its land is lighter than its water, so black reaches only 2.74:1 on that water while white reaches 1.20:1 on the light style's land.
Flow — the
clientspreview sessionStandalone only. Nothing of it enters
Widget.tsx's import graph, whichWidget.standalone.test.tswalks.Contract — what a host can observe
Paraphrasing
docs/embedding.md§ "Your brand colours reach the map", one rule per line:Files
Preview
Cloudflare has not aliased this branch yet — preview pending. Both the app and the Ladle playground are worth opening on a UI change this wide.
Contract impact
docs/embedding.mdandCHANGELOG.mdboth change here. A host sees adjusted colours and outlined pins; nothing about the snippet, the CSP, the Permissions Policy or the URL shape moves.DEFAULT_SEEDS(ATLAS_DEFAULT_COLORS,color2andcolor3only) and the three message shapes. See the merge order below — the ⚠ mirror comment on both files is satisfied by the set, not by this PR alone.Test results
--full: ✓ lint, typecheck,test:run(168 files / 2053 tests), build,pnpm sizepnpm size: standalone 330.2 KiB, embed 331.2 KiB, against the new 334 KiB budget — 3.8 and 2.8 KiB spare, and about 1.6 KiB above the credentialed build this gate cannot measureclients.test.ts— all greenManual verification
Everything about the map needs a browser, and
VITE_MAPBOX_ACCESSTOKENis not in the committed.env, so none of it ran here.#ffff00as the brand colour as much as with a careful one.Notes for reviewer
Second of three PRs in one set. Merge order: sydevs/SahajCloud#1127 (the write-only mailing-list key) → this one → sydevs/SahajCloud#1110's PR (the Atlas-tab preview). This one produces the message format and the retuned seeds that the third consumes.
Four judgement calls:
colord/plugins/labis the eager cost, andselected-distinctis a colour-versus-colour measure the a11y plugin cannot make. Every embed owes that check, so it cannot be deferred behind the standalone seam. Service managers see their brand colours live, and the atlas keeps them readable #388's notes estimated ~10 KiB of headroom; there was none.@payloadcms/live-previewis now a direct dependency, pinned to3.90.2like its-reactsibling, which already pulled it in transitively. One import,ready— six lines that spell a protocol message. The alternative was writing that literal out a second time.suggestedis a seed that renders itself, not simply the rendered hex. The ladder works in HSL and emits a quantised hex, so feeding the rendered colour back can land a point the other side of a check and be corrected again — the volunteer's colour would change a second time the moment they accepted the first suggestion. Zero of ~37k swept seeds now fail to settle.boundsLayeris in no check, per Service managers see their brand colours live, and the atlas keeps them readable #388: it is debug-only, behindDEBUG_BOUNDARY.Detail
Dismissed review findings, with reasons.
selected-distinctthe full step-9 range ("Accepted"); pure white is the extreme of that. The white outline is then invisible against it, which costs nothing: the outline exists to separate the pin from a mid-toned basemap, and a near-white fill already does that on its own.BrandThemepaintsprop ?? client record. They diverge only for a role the message omits entirely. Payload posts the whole form state, so all three keys are always present — a cleared picker posts'', which both sides read as unset.Accepted costs, now carried as
shortcut:markers beside the code. The stock art is per-basemap, so an unbranded embed holds eight decoded images rather than four and its first theme switch decodes instead of answering from a warm cache. Aclientspreview session retains four more bitmaps per palette for the life of that tab — about 86 KB a palette, in one manager's own admin iframe. Both have a stated trigger for revisiting.panel-textcannot be fixed by a seed. Steps 11 and 3 take fixed lightnesses, so a seed supplies only hue and saturation; at the teal hue the pair passes only below about 14% saturation, which no longer reads as teal.#1E6C71therefore stays the primary seed and the correction moves its text step instead (L40 → L32).secondaryandcontrastwere retunable and were retuned.The separation fallback moves no colour today. It was swept over 274,799 primary/contrast/mode combinations before and after the
surfaceconstraint was added: the built scales are byte-identical, the fallback fires 11,476 times and never once in light mode, and its worst surface ratio is 4.98. The constraint makes the invariant structural rather than a coincidence of the two ranges.Security review: ran, no findings. It traced the origin check on the listener, what the report can carry, and whether a colour string can escape the marker SVGs (it cannot — every colour is re-emitted by
colord(...).toHex()as six hex digits, and the art is loaded as an image, where script is inert).Closes #389
Generated by Claude Code