Skip to content

ui-kit: the Android status bar stays dark when the app is switched to Paper #2574

Open

Description

@schlessera

Context

On Android, an installed PWA's status bar takes its colour from the page's <meta name="theme-color">, or from the manifest's theme_color when the page has none. brain-kit gives the host one dark value for both: WEB_APP_COLORS sets theme_color and background_color to the icon tile's ground #0c1417 (packages/ui-kit/src/brand.ts:83-84), and nothing is exported for a light scheme.

The app can be switched to Paper (light) in Settings, or follow the system. useApplyTheme only writes <html data-theme> (useApplyTheme, packages/ui-react/src/components/layout/theme.tsx:20-26), so a user on Paper gets a dark status bar above a #ece7dc canvas (--bk-color-canvas: light-dark(#ece7dc, #0c0e12), packages/ui-kit/src/tokens.css:45). The app already knows the effective scheme: useColorScheme (packages/ui-react/src/hooks/use-color-scheme.ts:17-31) resolves the preference, defaulting to "dark" (packages/ui-react/src/stores/ui-state.ts:226), and under system the OS setting.

The host owns index.html, so the initial meta tag is a host change, tracked in schlessera/brain-hosting-template#34. This issue ships the values and the runtime update.

Guide: (no guide). Support (MDN BCD 8.1.6): <meta name="theme-color"> is in Chrome for Android 39 and Samsung Internet 6.2, and not in Firefox for Android, which ignores it. Chrome for Android uses it in dark mode only for installed PWAs, which is the target here.

Binding: the brand exports are documented in package-api.md "Logo assets", so a new export is an additive contract change.

Scope

  • ui-kit brand entry: export THEME_COLORS = { light, dark }, taken from LIGHT_TOKENS["color-canvas"] and TOKENS["color-canvas"] rather than repeated literals. Also export HTML_THEME_COLOR_META = { name: "theme-color", content: THEME_COLORS.dark }, the tag a host writes into its head beside HTML_ICON_LINKS (brand.ts:99-103), matching the app's default dark preference.
  • ui-react: while the app shell is mounted, keep the content of the document's first <meta name="theme-color"> equal to THEME_COLORS[scheme] for the effective scheme from useColorScheme, following preference and OS changes. If no such tag exists, create one. Leave any media attribute the host set untouched, except on the tag being updated.
  • Document both exports in package-api.md's "Logo assets", and note the runtime update in the useApplyTheme doc comment.

Out of scope

Acceptance criteria

  • THEME_COLORS.light === "#ece7dc" and THEME_COLORS.dark === "#0c0e12", asserted in a ui-kit test that derives them from the token tables, so a token change cannot drift silently.
  • In a real-browser test (ui-react-layout project), with a host meta of content="#0c0e12", selecting Paper changes it to #ece7dc, selecting Dark changes it back, and under System it follows an emulated prefers-color-scheme change. The test fails on the tree before the change.
  • With no meta in the document, mounting the shell creates exactly one, and unmounting does not leave a second one behind after remounting.
  • Firefox for Android needs no detection, since an ignored meta is harmless; the PR states this.
  • package-api.md, the api-report and a changeset for ui-kit and ui-react land in the same commit, prefixed CONTRACT:.

Verification

bun run test packages/ui-kit/tests
bun run test:layout
bun run api-report
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

Activity

  1. added
    type: feat
    area: ui-react
    area: ui-kit
    priority: p3
    agent-ready
    contract
    upstream: brain-hosting-template
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-kitarea: ui-reactcontractpriority: p3type: featupstream: brain-hosting-template

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions