Skip to content

feat(create-canvas-app): make the canvas kit theme-aware (light/dark) - #25

Merged
jongio merged 2 commits into
mainfrom
canvas-theme-aware-kit
Jul 6, 2026
Merged

feat(create-canvas-app): make the canvas kit theme-aware (light/dark)#25
jongio merged 2 commits into
mainfrom
canvas-theme-aware-kit

Conversation

@jongio

@jongio jongio commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What

Makes the create-canvas-app canvas kit theme-aware so a canvas follows the user's light/dark theme instead of always rendering dark.

The host (github-app) injects theme-aware Primer tokens onto the canvas document, but only in on_page_load (after first paint), and the kit fallbacks were dark-only, so light-theme users saw a dark flash. --ck-bg-inset also aliased --background-color-emphasis, a dark chip color in light mode, which painted chips, filter pills, tab-count badges and slider tracks as dark boxes on a light canvas.

Changes to kit/theme.css

  • Derive --ck-bg-inset from --ck-bg-muted + --ck-fg instead of the wrong emphasis token (dark stays ~#363c43, light becomes ~#d6d8db).
  • Add a prefers-color-scheme: light fallback plus color-scheme, both gated on :root:not([data-color-mode]) so the host stays fully in control the moment it injects its tokens (it sets data-color-mode alongside them and an explicit color-scheme).
  • Theme-neutral skeleton shimmer (was a white-on-dark gradient invisible on light).

Bumps the kit to 2026-07-05.1.

Validation

Verified in Chromium across every path: un-injected OS light and dark, injected light over OS-dark (host wins), and injected dark (inset unchanged). Vendored into jongio/copilot-extensions#20 via sync-kit, whose lint, validate, and smoke suites pass.

jongio and others added 2 commits July 5, 2026 22:35
kit/theme.css: derive --ck-bg-inset from --ck-bg-muted + --ck-fg (drops the
wrong --background-color-emphasis alias, which is a dark chip color in light
mode and painted inset surfaces as dark boxes on a light canvas), add a
prefers-color-scheme:light fallback plus color-scheme gated on
:root:not([data-color-mode]) so the host stays in control once it injects its
tokens after first paint, and use a theme-neutral skeleton shimmer.

Bumps the kit to 2026-07-05.1. Vendored into jongio/copilot-extensions via
sync-kit (companion PR).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…7-05.1

The theme-aware kit change bumped kit/theme.css + kit/version.mjs but left reference/decision-log/canvas-kit/ at 2026-07-04.1, so kit-parity and freshness checks fail. Re-run sync-kit.mjs to mirror kit/ into the reference decision-log example (theme.css, version.mjs, .kit-version.json).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio
jongio merged commit 8c11d9a into main Jul 6, 2026
@jongio
jongio deleted the canvas-theme-aware-kit branch August 27, 2026 16:16
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