Skip to content

theme: export color metadata and sync docs#226

Open
geoquant wants to merge 37 commits intocloudflare:mainfrom
geoquant:geoquant/color-docs
Open

theme: export color metadata and sync docs#226
geoquant wants to merge 37 commits intocloudflare:mainfrom
geoquant:geoquant/color-docs

Conversation

@geoquant
Copy link
Collaborator

@geoquant geoquant commented Mar 13, 2026

Summary

  • export shared theme metadata from @cloudflare/kumo and switch registry/Figma consumers to use it instead of scraping semantic colors from CSS
  • make the colors docs page data-driven from package metadata, remove stale token/theme guidance, and add concise token authoring docs without redesigning the page
  • keep generated light-dark() theme registration for semantic utility compatibility, while continuing to use explicit [data-mode] scoped variables to prevent flicker
  • ban raw light-dark(...) and var(--color-...)/var(--text-color-...) usage inside component class strings so token usage stays lint-enforced

Toast Token Decision

We found raw class-string color values in packages/kumo/src/components/toast/toast.tsx:

  • old error: light-dark(var(--color-red-600), var(--color-red-400))
  • old warning: light-dark(var(--color-amber-700), var(--color-amber-500))

For this PR, we intentionally switched to the nearest existing semantic tokens instead of introducing new ones:

  • new error: text-kumo-danger -> red-500 light / red-400 dark
  • new warning: text-kumo-warning -> yellow-800 light / yellow-400 dark

This keeps component code on semantic tokens and lets lint enforce the rule. If design wants exact parity with the prior toast colors, the follow-up should add dedicated tokens in packages/kumo/scripts/theme-generator/config.ts rather than reintroducing raw values in component classes.

Screenshot 2026-03-17 at 11 31 45 AM

Verification

  • pnpm --filter @cloudflare/kumo codegen:themes
  • pnpm --filter @cloudflare/kumo typecheck
  • pnpm --filter @cloudflare/kumo exec vitest run scripts/theme-generator/generate-css.test.ts scripts/component-registry/utils.test.ts tests/imports/package-json-validation.test.ts tests/lint/no-primitive-colors.test.ts
  • pnpm --filter @cloudflare/kumo lint
  • pnpm --filter @cloudflare/kumo build
  • pnpm --filter @cloudflare/kumo-docs-astro typecheck
  • pnpm --filter @cloudflare/kumo-docs-astro build
  • pnpm --filter @cloudflare/kumo-figma typecheck
  • pnpm --filter @cloudflare/kumo-figma validate

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 13, 2026

npm i https://pkg.pr.new/@cloudflare/kumo@226

commit: 4882d7d

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Docs Preview

View docs preview

Commit: 4882d7d

@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Visual Regression Report

8 screenshot(s) with visual changes:

Button / Icon Only

9,697 px (3.57%) changed

Before After Diff
Before After Diff

Button / Loading State

6 px (0%) changed

Before After Diff
Before After Diff

Button / Disabled State

2,793 px (1.12%) changed

Before After Diff
Before After Diff

Dialog / Basic Dialog

96,424 px (1.84%) changed

Before After Diff
Before After Diff

Select / Basic Usage

14,234 px (2.57%) changed

Before After Diff
Before After Diff

Select / Loading

0 px (0%) changed

Before After Diff
Before After Diff

Select / Select.Option

19,481 px (2.27%) changed

Before After Diff
Before After Diff

Select (Open)

0 px (0%) changed

Before After Diff
Before After Diff
19 screenshot(s) unchanged
  • Button / Variants
  • Button / Sizes
  • Button / With Icon
  • Dialog / Alert Dialog (role="alertdialog")
  • Dialog / Confirmation Dialog (with disablePointerDismissal)
  • Dialog / With Actions
  • Dialog / With Select
  • Dialog / With Combobox
  • Dialog / With Dropdown
  • Dialog (Open)
  • Select / Without Visible Label
  • Select / With Description and Error
  • Select / Placeholder
  • Select / Label with Tooltip
  • Select / Custom Rendering
  • Select / Multiple Item
  • Select / Multiple with Custom Indicator
  • Select / More Example
  • Select / Select

Generated by Kumo Visual Regression

@geoquant
Copy link
Collaborator Author

Reviewed the branch again after fixing the docs copy mismatch.

A few files in this PR are not core to the color/theme/metadata change, but I left them in intentionally for observability rather than hiding them:

  • packages/kumo-docs-astro/src/components/SearchDialog.tsx
    • adds runtime validation for the fetched component registry shape
    • this came up while keeping docs typecheck / feedback loops green
  • packages/kumo-docs-astro/src/components/demos/TabsDemo.tsx
    • fixes render-prop anchor content in the demo
    • unrelated to colors, but surfaced during docs feedback-loop cleanup
  • packages/kumo-figma/src/generators/select.ts
  • packages/kumo-figma/src/generators/drift-detection.test.ts
    • small figma validation / drift-detection fixes needed while touching the figma token pipeline
  • packages/kumo/src/code/provider.tsx
  • packages/kumo/src/code/server.tsx
    • lint-suppression cleanup only

Happy to remove / split any of those if reviewers want the PR to stay narrower.

Also: I rebuilt the Figma plugin locally while checking the stale-runtime concern. packages/kumo-figma/src/code.js is still gitignored by repo convention, so it is not part of the PR diff, but local build output now matches the metadata-driven source.

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