Skip to content

feat(extension): share the redesigned theme with web via @crypt.fyi/theme - #165

Merged
dillonstreator merged 1 commit into
mainfrom
claude/chrome-extension-redesign-sync-5adfab
Nov 6, 2026
Merged

dillonstreator merged 1 commit into
mainfrom
claude/chrome-extension-redesign-sync-5adfab

Conversation

@dillonstreator

Copy link
Copy Markdown
Member

What changed

  • New @crypt.fyi/theme package (private, no build step): light and dark tokens, the Tailwind theme mapping, self-hosted fonts, theme preference logic, and theme-init.js with a small Vite plugin that serves it and adds its script tag.
  • Web now uses the package. No visual change is intended.
  • Extension settings page is rebuilt on the shared tokens and fonts, with a System/Light/Dark control. Element IDs are unchanged, so the form logic in main.ts only gains a theme import.
  • Docs (AGENTS.md, extension README, package README) and a changeset.

Why

The redesign in #159 only touched web, so the settings page kept the old look and a hand-copied palette.

It also had a bug: styles.css nested @theme inside @media (prefers-color-scheme: dark). Tailwind drops the media query, so the dark values overwrote the light ones and the page was always dark.

Notes for reviewers

  • Components aren't shared, on purpose. Web uses React and shadcn, and the settings page is plain HTML. Sharing components would add React to the extension for one form, so styles.css has a few equivalent CSS classes instead.
  • Web CSS diff: I compared compiled CSS before and after. The only differences are that fonts are referenced through CSS variables, and an unused .ring class is gone. It was generated only because Tailwind scanned the word ring in the old config.
  • theme-init.js moved from packages/web/public to packages/theme/src. The URL is still /theme-init.js, so CSP is unaffected and no style-src hashes changed.
  • Unlayered body rule in the extension: Chrome injects its own font and 75% text size on extension pages, and that beats Tailwind's layered base styles.
  • Theme choice is per origin: the extension and web keep separate preferences because each uses its own localStorage.
  • Bundle size: the extension gains about 270 KB of Inter and Space Grotesk font files.
  • Copy: the new theme control's labels are hard-coded English, like the rest of the settings page.

Testing

  • Format, lint, typecheck and unit tests pass for web, extension and theme, including 12 new tests in theme.
  • pnpm test:e2e: all 5 tests pass, including the CSP and theme specs.
  • Loaded the built extension in headless Chromium:
    • It follows the OS theme and reacts when the OS changes.
    • An explicit choice survives a reload, and the stored theme applies before the main bundle runs.
    • Save writes to storage.
    • Fonts load, and there are no page errors or horizontal overflow at 375px.

Not tested: the extension's own dev mode, the Docker image, and a normal non-headless Chrome.

Existing behavior, not addressed here: on a fresh profile in headless Chromium, the form stayed empty for about 2 seconds on first load. The unmodified extension also showed an empty form after 1.5 seconds, so this isn't new.

…heme

The web redesign left the extension settings page on the old neutral palette,
with tokens copied by hand. Its dark tokens also nested @theme in a media query,
which Tailwind flattens, so the page always rendered dark.

- Add a private, build-free @crypt.fyi/theme package holding the tokens, fonts,
  preference logic and the pre-paint theme-init.js script.
- Move web onto the package. Its compiled CSS changes only in how fonts are
  referenced, plus the removal of an unused .ring class.
- Rebuild the settings page on the shared tokens with a System/Light/Dark control.
  It stays plain HTML, so UI components are not shared.
- Override the font and 75% text size Chrome injects on extension pages, which
  would otherwise beat the theme's layered base styles.
- Test the colors copied into theme-init.js so they cannot drift.
@dillonstreator
dillonstreator merged commit 91572c8 into main Nov 6, 2026
8 checks passed
@dillonstreator
dillonstreator deleted the claude/chrome-extension-redesign-sync-5adfab branch November 6, 2026 22:27
@github-actions github-actions Bot mentioned this pull request Nov 6, 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.

1 participant