A local-first multi-agent app development platform, built on PenguinHarness
The shared UI package, its token contract, and the default theme wired into the Web App
- Date: 2026-09-16
- Type: refactor
- Scope:
ui,web,ci - PR: #765
The first step of the theme system. A private, source-only package, @prismshadow/penguin-ui
(packages/ui), took over the Web App's colours, radii, shadows, fonts and focus and scrollbar
rules as one named set of design tokens, and the current look became its default theme, github,
value for value: the twelve pages the pixel diff covers render identically in both modes and both
languages, and the one rule whose font stack moved, .font-sans, is described below. The one
intended visible change is on first load: the stored light/dark mode, accent and font size are
applied before the first frame, so a dark page no longer flashes white while the bundle loads and
the first frame no longer renders at 16px and reflows to the 18px default.
Details
tokens.tsholds the contract: 186--ui-*names in 15 groups (surfaces, text, lines, accent, six semantic tones × five parts including the newdoneandinfo, charts, code and diff, shape, elevation and glass, type families, the type and heading scale, density, motion, icons, focus/selection/scrollbar), plus the theme idsgithub/modern/geek.theme.cssdeclares thedarkvariant, two cascade layers after Tailwind's own (ui-theme, thenui-accent, so an accent preset always beats a theme's dark block), a bridge that exposes the tokens as utilities (bg-surface,text-fg-muted,border-line,bg-accent,text-tone-danger-fg, …) and re-points Tailwind's font, radius and shadow scales at them, the base rules that read tokens, and the five accent presets..font-sansreads the app's own sans stack (--ui-font-sans) instead of Tailwind's stockui-sans-serif, system-ui, sans-serif, …. One element uses the class, the full-prompt preview folded into the Create-with-AI dialogs: its Latin text keeps its face (system-uiis second in both stacks), and its CJK text now resolves through the named PingFang SC / Microsoft YaHei instead of the OS fallback, the same face on most systems but not guaranteed on Windows.themes/github.cssdefines every token with the app's existing values, and a gray bridge that re-points Tailwind's--color-gray-*and--color-white, so the existing gray classes follow the theme with no component edits. Its base rule holds every token; its dark rule holds only the values dark changes, so a mode-independent group (shape, type, density, motion, icons) is written once.themes/modern.cssandthemes/geek.csswere added as empty placeholders.boot.tsgenerates the pre-paint script now inlined inpackages/web/index.html, and theapplyThemeAttributes()the theme provider reconciles with. The darktheme-colorbecame#000000, the page's real dark background.- The theme provider gained a stored theme id (
penguin.themeId, defaultgithub), applied ashtml[data-theme]; no setting exposes it yet. The key is classified as a browser preference for the data-root sweep. - The Web App depends on the package as
workspace:*, which pnpm links topackages/ui, so Vite, vitest and tsc read its live source through the package'sexports, and Tailwind scans the package's source.styles.cssdropped the rules the package now owns. - Call sites that spelled
var(--accent-bg)/var(--accent-fg)moved tobg-accent,border-accent,ring-accentandtext-accent-fg, and the threebg-black/45dialog backdrops moved to the--ui-overlay-backdroptoken.--accent-bg/--accent-fgremain as aliases for one wave. packages/web/scripts/theme-shots.mjscaptures twelve pages × light/dark × en/zh from any number of web builds against one server, one data set and a frozen clock, and diffs the shot trees pixel for pixel.- The CI
web-clishard runs the new package's tests, and the port table inpackages/core/src/internal/ports.tsreserves 7372 for the component gallery's dev server.