Skip to content

fix(theme): sync browser toolbar colour with the active palette - #37555

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/kiro-crew-rust/mwg-theme-color-ef53
Nov 15, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/kiro-crew-rust/mwg-theme-color-ef53

Conversation

@buluoray

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Keep the browser toolbar colour hint in step with the chosen dashboard palette.

The page changes colour, but its theme-color meta tag stays dark.

Why it matters

Browsers that use this hint receive the wrong colour after a palette change.

Not a goal

  • Change page colours or animations.
  • Claim a speed improvement.
  • Force a browser to honour the colour hint.

What changed (motivation → approach → change)

The theme hook reads the chosen background token and updates the existing meta tag. It reads the target colour, not the body's colour mid-transition. The themes spec names this behaviour. Tests cover mode and palette changes, absent CSS, a missing tag, and unmounting.

Backwards compatibility

Compatible: existing theme choices and page styles remain unchanged.

Removes nothing: no setting, palette, or browser fallback is removed.

Tests

Proof: not provable -- frontend test (prove.py runs Python only)

  • The new behaviour test fails without the implementation: the tag keeps #0d0f12. It passes with the implementation.
  • TypeScript project check and targeted ESLint pass.
  • New tests passed 20 shuffled serial runs, then 10 shuffled runs beside the existing useTheme tests with four workers.
  • The theme-only production build passes.
  • Refreshing an installed palette under the same slug was checked in source, but has no dedicated regression test. Custom palette values with alpha were not tested in browser chrome; the browser decides whether to use the hint.
  • The broad local gate stopped in backend batch 1: 60 failures and 5 errors. Representative file-explorer, doctor and app-install failures, plus the missing h2 dependency, reproduce on untouched base 4c530d0. No backend source differs. The remaining broad batches were not run; this is not a clean full-gate claim.

Manual verification

The real production bundle ran in Chromium with mocked boot API responses. After each theme sync event, the root palette and meta value were read from the DOM. Every built-in palette matched its --bg token in both modes; no page errors occurred. This is metadata verification, not a recording of a real model flow.

手机上的顶栏颜色未在真机上看,Ray 可以在 iPhone 上确认。

Palette Dark Light
emerald #12141a #fafafa
monokai #272822 #fafaf5
solarized #002b36 #fdf6e3
amber #12141a #fafafa
dracula #282a36 #f8f8f2
nord #2e3440 #eceff4
rosepine #191724 #faf4ed
catppuccin #1e1e2e #eff1f5
tokyonight #1a1b26 #d5d6db
gruvbox #282828 #fbf1c7
ice #0f1729 #f0f9ff
amoled #000 #fafafa
kiro #19161d #fff
intellij #191a1c #eff0f2
highcontrast #000 #fff
everforest #1e2326 #fffbef
amoled-midnight #000 #fff
amoled-grey-calm #000 #f9fafb
nu-disco #0c001f #f8f7f8
amethyst-oled #000 #faf9ff
colorblind #101216 #fff

Screenshots / video

Why no screenshot: This changes a non-rendering meta attribute, not page pixels. A headless page screenshot cannot show browser chrome. The owner approved DOM tests and the value table as evidence.

Related Issues

Closes #37542

Sibling sweep

Swept: git grep -n 'theme-color' -- website/src website/index.html

Siblings: none -- the dashboard has one tag; editionShell tests patch only its boot value. The shared theme provider handles all palettes and resolved modes.

Pattern harvest

Not generalizable: the existing meta tag lacked a theme update; the body transition makes its current colour unsuitable as the target value.

Checklist

  • One commit with a Conventional Commits title
  • Related tests pass; new tests cover metadata updates
  • Local review completed: GPT found no blocking issues; Opus Low notes were addressed by a test-name correction and explicit limits above
  • Themes documentation updated
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 licence.

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 15, 2026 07:45
@buluoray
buluoray requested a review from CrysisDeu November 15, 2026 07:45
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 21290a7c3baee6e005cd1b7d339337438a3fe704 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The diff changes only the theme-color meta hint (browser chrome, not page UI) and adds no control, label, state or copy. With no control to show, a screenshot isn't needed.

[UX-REVIEWED] 21290a7

Description read

[DESCRIPTION-READ] e9888844ed9ee6696a08e48d7a77edc4b3ebf230a23f509d3f85e036dfb069d1

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 21290a7c3baee6e005cd1b7d339337438a3fe704 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a small, reversible effect on the existing theme hook that reads the target --bg token. It is shaped correctly for keeping the toolbar colour hint in step with the palette.

[DESIGN-REVIEWED] 21290a7

Description read

[DESCRIPTION-READ] 6e33e55aa93decb00168e4568b80b858155e8ea14bcceb8744fc9200c36ea98b

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 21290a7c3baee6e005cd1b7d339337438a3fe704 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The change is one effect on the existing meta tag, tied to linked issue #37542, and the added test fails on base.

What this change ships

Inventory (5 items) — 5 justified

Intent: keep the browser toolbar colour the same as the dashboard palette the user picks. This is a FIX.

  1. After the page boots, the browser toolbar colour follows each mode and palette change, including a refreshed installed palette. — justified
  2. An edition's branded themeColor now applies only until the first theme paint, then --bg replaces it. This matches the pre-boot scope in website/docs/extension-seams.md:131. — justified
  3. When no CSS --bg token exists, the HTML boot colour stays in place. — justified
  4. A "Browser toolbar colour" section is added to docs/system-specs/modules/themes.md, as the same-commit spec rule requires. — justified
  5. A new test file, useTheme.browserChrome.test.tsx, covers mode and palette changes, missing CSS, a missing tag and unmount. — justified

[FIRST-PRINCIPLES-REVIEWED] 21290a7

Description read

[DESCRIPTION-READ] effe3f29dd71afc7da3bcd58aaa6f426d1013c47fe4c66d837680adaa25c296c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 21290a7c3baee6e005cd1b7d339337438a3fe704 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 21290a7

Verdict parsed from the review's SHA-scoped output markers for commit 21290a7c3baee6e005cd1b7d339337438a3fe704.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 21290a7c3baee6e005cd1b7d339337438a3fe704 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 21290a7c3baee6e005cd1b7d339337438a3fe704 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 21290a7

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 21290a7c3baee6e005cd1b7d339337438a3fe704 false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

The PR adds one effect to useThemeState. On each theme change it reads the computed --bg token from the document root and writes it into the existing <meta name="theme-color"> tag. It copies the existing --accent sync just below it: the same deps (resolved, colorTheme, themeVersion), the same rAF read and the same cancel on cleanup. Installed-palette refreshes are covered because bumpThemeVersion fires after applyTheme and after the custom-theme data map changes. The failed-pack fallback is covered because that path also bumps the version. If the tag is missing nothing happens, and if there is no --bg the boot colour is kept.

The only other writer of the tag is the build-time editionShell patch. That patch still works, and its tests don't touch runtime behaviour. The new tests cover mode change, palette change, missing CSS, a missing tag and unmount. They depend on applyTheme setting dataset.theme and dataset.mode on documentElement, which it does at useTheme.tsx:214-215, so they would fail without the change. The spec doc is updated in the same commit, as the repository requires. No trust boundary, persisted state or limit is touched.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 21290a7c3b · 112 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

CI repair and before/after evidence

Local candidate: 99992d50a6eb2db2ad222b4b18b9ef839b236f01 (not yet pushed).

The existing EmbeddedDragRegionReporter test passes on base 55b2e4a and fails on the original PR head: the theme effect queued animation frames even without a theme-color tag. The candidate returns before scheduling when the tag is absent. The reporter test was not weakened. All 19 related frontend tests pass; removing the new guard fails the zero-queued-frames assertion.

The three backend TestOffOffer failures also reproduce on the untouched base. Main now contains #37545; the candidate includes it, and all three exact tests pass.

The screenshots below come from the real built pages, with mocked boot API replies and synthetic chat data. The labels show values read from the DOM, not a simulated browser toolbar:

Light palette Before After
theme-color #0d0f12 #fff
--bg #fff #fff

Before source: 55b2e4a. After source: 99992d50a6eb2db2ad222b4b18b9ef839b236f01. Mode: 412x915, Kiro light. The actual phone toolbar has not been checked; Ray can confirm it on iPhone. This is not performance evidence.

Page screenshots with measured DOM values

The pinned image URL returns 200 image/png and matches the local SHA-256: ee36b95f839213e350abcbea0273a10df4945c64770ce5cb3a45331ee2c517f5.

@buluoray
buluoray force-pushed the crew/kiro-crew-rust/mwg-theme-color-ef53 branch from 8ba0b5e to 21290a7 Compare November 15, 2026 08:39
@buluoray

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/metrics/test_kiro_export_destination.py (55b2e4a -> 2e56b3b), including the fix from #37545. CI is re-running on 21290a7.

The missing-meta animation-frame regression is fixed in this head. All 19 related frontend tests pass, and all three exact backend TestOffOffer failures pass after the mainline fix. The existing EmbeddedDragRegionReporter assertion remains unchanged. Removing the new early return makes the no-queued-frame assertion fail.

The comparison image in the previous evidence comment was captured from candidate 99992d50a6eb before this final clean rebase. The three PR files are byte-identical between that reviewed candidate and this head; the source labels on the image deliberately retain the actual capture commit. The image is page-only with synthetic chat data, not a browser-toolbar capture. The iPhone check remains with Ray.

The description still contains source links pinned to the original head. Current source: https://github.com/kirodotdev/KiroCrew/blob/21290a7c3baee6e005cd1b7d339337438a3fe704/website/src/hooks/useTheme.tsx . No auto-merge or review override was enabled.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 15, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 15, 2026 09:52

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. On this head the review read the full diff. The new effect in useTheme.tsx uses the same pattern as the --accent effect beside it: the same deps, a read of the computed --bg token on the next frame, and a cancel on cleanup. Every path that changes the root --bg is covered: mode, palette, the installed-palette fallback and pack detail loads. Writing meta.content opens no injection path. The new tests are deterministic, clean up after themselves, and fail if the fix or any of its guards is removed. The themes.md update ships in the same commit, and nothing like this is already on main.
Done well: the tests drive animation frames by hand and cover each edge case on its own (tag missing, no token, unmount).
Optional:

  • website/docs/extension-seams.md could say that an edition's branding.json themeColor now applies only until the theme provider mounts. After that the tag follows the palette's --bg.
  • One test could pin the themeVersion dep: refresh an installed palette under the same slug and check that the tag follows the new --bg.
  • useTheme.tsx is now 1,681 lines. Moving the host chrome sync effects into a small sibling hook later would keep it smaller.

@KiroCrewCaptain
KiroCrewCaptain merged commit fd81f08 into main Nov 15, 2026
99 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/kiro-crew-rust/mwg-theme-color-ef53 branch November 15, 2026 09:52
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
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.

Browser theme-color stays dark after switching to a light palette

2 participants