feat(udg): canonical bg.surface-card token and a no-fallback theme marker (#233) #236
No reviewers
Labels
No labels
build-dist
priority
P1
priority
P2
priority
P3
priority
P4
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Toilville/toilville-design!236
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/233-bg-surface-card"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #233. Does not close it: the Rituals counterpart is a separate PR in
toilville_rituals.Scope
Makes the card surface a canonical token and adds a guard so other themes cannot inherit it by fallback. Implements the decision in the #233 comment (issuecomment-38127).
Brand/UDG/products/rituals/dtcg/color.json: newcolor.bg.surface-card. Light#E2AC96, dark#5F2E1C, vanillanight#333333.udg.dart-keystaysbgSurfaceCard.udg.theme-fallback: none. A marked token has a value only in the themes its$valuelists. It must still definelight. Any other value of the marker fails the build.udg/generators/extract.py: omits the token for the other themes intokens.dtcg.json, and resets its CSS var toinitialin theirskin.cssblocks.udg/generators/native.py: no entry for those themes in the native manifests.udg/generators/wcag.py: skips the token's pairs there. New pairtext.primaryonbg.surface-card, checked in the three themes that define it.udg/generators/artifact.py: the swatch has no baked fallback colour.udg/mcp_server.py:get_color_tokenreports "no value" instead of the light value.bg.surface-cardis the only marked token. The six other themes (Accessible Alt, Cosmic Crisp, Pardner, Sundered, Truancy, Vanilla Day) get no card surface value. Their palettes are work in progress and this PR makes no decision for them.README.md,Brand/UDG/README.md: the marker is documented.generator/tests/unit/test_theme_fallback.py: 11 tests.dist/: regenerated, 18 files.Testing
justfilecheck commands pass. Each command was run directly becausejustis not installed on this machine.python3 -m pytest generator/tests/: 411 passed, 20 skipped. With the marker removed from the source, the new tests fail.extract.pygive byte-identical output for all 13 products when the marker is stripped. The marker changes nothing for unmarked tokens.text.primaryonbg.surface-card: light 8.52:1, dark 9.17:1, vanillanight 12.63:1.skin.css: in Cosmic Crisp, Pardner and Vanilla Day the var is invalid.background: var(--udg-color-bg-surface-card)resolves to transparent, and a consumer fallback is used when one is given. Child elements inherit the invalid value. Other tokens in those themes are unaffected.dist/rituals/artifact.html: the card swatch is transparent in those three themes. It showed a stray pale peach before the artifact fix.apps/rituals-macos/tool/dtcg_to_udg_tokens.py --checkintoilville_ritualspasses against this output.Impact Statement
--udg-color-bg-surface-card, new Dart key already used by the Flutter app. New optional token keyudg.theme-fallback. In the six themes above the var isinitial. A consumer that needs a colour there must pass avar()fallback.tokens.dtcg.jsonentries may now list fewer themes than the product has, when the marker is set. Readers that look up a missing theme must not assumelight.dist/ritualsanddist/blocksare regenerated.blocksborrows the Rituals palette (color_from: rituals). Itsskin.cssandtokens.dtcg.jsonchanges match the Rituals ones.dist/rituals/udg_tokens.{dart,swift,json}gain the card entries.toilville_ritualstakesudg_tokens.dartthroughudg_colors.dart(separate PR). macOS Swift has no consumer and gains none. The macOSudg_tokens.jsonis unchanged.wcag.pygains one pair.forgejo.py, still falls back tolight. A test fails if any reader outside the allowlist names this token.