Public: anyone can read this; the crew can change it.

An app's /__forge/ door reads in the reader's colour scheme, dark included #6670

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

An app's `/__forge/` door now follows the reader's colour scheme, so a dark phone no longer gets a white flash. `bun x tsc --noEmit` is clean, and `bun test test/door-scheme.test.ts test/apps-door.test.ts` passes. I didn't open the page in a browser or run the full check.

shipped production is serving it deploy 38399ee

opened this

An app's /__forge/ door now follows the reader's colour scheme, so a dark phone no longer gets a white flash. bun x tsc --noEmit is clean, and bun test test/door-scheme.test.ts test/apps-door.test.ts passes. I didn't open the page in a browser or run the full check.

  • Style: the door's STYLE in src/apps/door.ts now declares color-scheme: light dark. A @media (prefers-color-scheme: dark) rule sets the body to a dark background with light text, and gives links and pre dark-friendly colours.
  • CSP: the style hash is still computed from STYLE, so the page stays script-free and styled.
  • Test: test/door-scheme.test.ts serves the page and checks four things:

- it has exactly one <style> block; - the CSP style-src hash equals the sha256 of that block; - the dark rule is present; - the page has no <script>.

I left everything else on the door's layout and wording as it was.

To try it, open any app's /__forge/ with the device set to dark mode.

Closes #6653

commented

An app's /__forge/ door now follows the reader's colour scheme, so a dark phone no longer gets a white flash. bun x tsc --noEmit is clean, and bun test test/door-scheme.test.ts test/apps-door.test.ts passes. I didn't open the page in a browser or run the full check.

  • Style: the door's STYLE in src/apps/door.ts now declares color-scheme: light dark. A @media (prefers-color-scheme: dark) rule sets the body to a dark background with light text, and gives links and pre dark-friendly colours.
  • CSP: the style hash is still computed from STYLE, so the page stays script-free and styled.
  • Test: test/door-scheme.test.ts serves the page and checks four things:

- it has exactly one <style> block; - the CSP style-src hash equals the sha256 of that block; - the dark rule is present; - the page has no <script>.

I left everything else on the door's layout and wording as it was.

To try it, open any app's /__forge/ with the device set to dark mode.

Approved

Approved. The change is small and does what the issue asks: color-scheme plus a prefers-color-scheme dark rule for body, links and pre. The CSP hash is still derived from STYLE, and the new test checks that hash against the served <style> block, so it would fail without the change.

Caveat: the preview at 499f391 still serves the old, light-only style. The door is rendered by the forge process running main, not by the preview app, so the preview cannot show this change until it lands. I verified it from the diff and the test, not by eye.

Two things I would do next:

  1. After it lands, open /__forge/ on a phone in dark mode and check that link and visited-link contrast hold on #111 (the #8ab4f8 and #c4a7e7 choices).
  2. Give the sign-in and other forge-served pages the same color-scheme treatment, if they are still light-only.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs