Skip to content

v1.2.10 — the bars are painted again

Choose a tag to compare

@stallenlu stallenlu released this 09 Nov 19:52
· 2 commits to main since this release

fix: paint the ranking bars with colours the host actually defines

The speed and intelligence bars have been invisible since 1.2.2, when the
hardcoded hex values were replaced with var() references. The replacements
pointed at --color-blue-500, --color-green-500 and --color-violet-500, which
the DSH host never defines. A dangling var() is not an error: it simply paints
nothing, so the bars kept their grey track and lost their fill.

The reason the mistake looked safe is dsh-context, which does reference those
names. It can, because it defines that palette itself in a <style> it appends
to document.head. Copying the references without copying the definitions left
every one of them dangling. The host's real palettes are --dsw-static-{hue}
for raw colour and --dsw-alias-* for semantics.

Six references are rewired to a primitive plus the dashboard's literal as a
fallback, so the panel is correct even if a future host drops the token:

state-success-primary, var(--color-green-500) -> ..., #22c55e (6 places)
label-tertiary, var(--color-neutral-500)-> ..., #7f8287
state-warn-primary, var(--color-amber-500) -> ..., #f59e0b
button-primary-fill, var(--color-blue-500) -> ..., #3b82f6
state-error-primary, var(--color-red-500) -> ..., #f43f5e
brand-primary, var(--color-blue-500) -> ..., #3b82f6

The two axes had no fallback at all and now do. The speed bar takes
--dsw-static-blue-500 with #3b82f6 behind it. The intelligence bar is a plain
#a855f7 rather than a token, because the host ships violet-400 (#a78bfa) and
violet-600 (#7c3aed) but no violet-500 — close is not the same as the colour
the :3001 table uses, and matching that table exactly is the whole point.

Two alias names were wrong for the same reason and are corrected:
--dsw-alias-border-secondary and --dsw-alias-border-1 do not exist, while
--dsw-alias-border-l2 does.

Verified by rendering the shipped stylesheet in headless Edge with the host's
real token values installed in a selector, then reading getComputedStyle.
Putting the declarations loose in a <style> is invalid CSS and drops them, so
an earlier version of this check measured only fallbacks and passed while the
bug was still there. With the tokens correctly scoped, all three bars resolve
and the speed and intelligence values are byte-identical to the dashboard's
#3b82f6 and #a855f7.