Skip to content

Minimal role token adoption - #1270

Draft
microbit-matt-hillsdon wants to merge 6 commits into
mainfrom
link-colour
Draft

Minimal role token adoption#1270
microbit-matt-hillsdon wants to merge 6 commits into
mainfrom
link-colour

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown
Collaborator

Lots of ramp references left for another pass but this restates the overrides in terms of role tokens and updates links.

Draft awaiting UI library release.

classroom and data-microbit-org already had dev:link-ui; this app did
not, which made working on @microbit/ui against it awkward.

dev:link-ui-patterns is new to both: the LanguageDialog pattern reads
the library's semantic tokens, so linking only @microbit/ui leaves a
published ui-patterns referencing token names the linked library may
have renamed.

No source changes were needed for the role-token restructure (Phase 3,
ui-private docs/role-tokens.md) — this preset only defines its own
sidebar* tokens, and the 15 raw var(--colors-gray-*) references in the
CodeMirror themes are unaffected because the ramps stay public and
unrenamed.
Symlinks ../python-editor-v3-microbit into node_modules, which is the
switch both panda.config.ts and vite.config.ts test for, so one link
moves the Panda codegen and the Vite alias together. Builds the theme
package first — both resolve it through dist. dev:unlink-theme reverses
it. Completes the set alongside dev:link-ui and dev:link-ui-patterns.
Moves the twenty link call sites onto `fg.link`, replacing the hardcoded
brand stops they each carried. The private preset sets `fg.link` to
brand.500 (#6c4bc1) — the value seventeen of them already used, and the
purple the non-app web properties use.

Two changes fall out.

The three Sanity documentation link marks were brand.600 (#50388f) rather
than the brand.500 everywhere else. That is 8.43:1 against the gray.75
sidebar they render on, but only 1.66:1 against the body text beside
them, so they read as bold-ish grey until hovered. brand.500 is 5.69:1
on that background and 2.46:1 against body text — still short of the 3:1
a colour-only link wants, which the underline work addresses separately,
but a clear improvement and consistent with the rest of the app.

On the OSS build (no private preset) links move from brand.500 #3182ce
to the base preset's brand.600 #2b6cb0. The OSS brand ramp is the family
blue, whose 500 is a fill grade at 4.03:1 — below AA as text. Nobody
ships that build, but it should not carry a failing default.

Links that deliberately inherit are untouched: the sidebar logo and the
serial traceback link sit inside dark surfaces, the search result row is
itself the link, and the MakeCode link in the load-error toast takes the
toast's white.
Panda accepts an unknown `semanticTokens` key silently — the override
never applies and nothing fails, so a rename in @microbit/ui would leave
this app on the library's colours with a green typecheck.

Covers the private brand preset too, when it is linked. That preset is
the reason the check exists: its four `toast*Bg` overrides went dead
when the library renamed them to `surface.*`, and the brand build's
toasts fell back to the library's teal. Checking it here rather than in
its own repo keeps that repo free of a dependency on @microbit/ui, and
runs the check where the merge actually happens.
Assert @microbit/ui's droppedConditionTokens alongside the existing
key check, for the app preset and (when linked) the brand preset: a
flat override of a { base, _onDark } token merges wholesale and
silently drops the dark-surface flip.
@github-actions

Copy link
Copy Markdown

Preview build will be at
https://review-python-editor-v3.microbit.org/link-colour/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant