Set up petal_components in this Phoenix + Tailwind v4 app with the look I dialed in at http://playground.petal.build/c/typography
1. Install petal_components per https://petal.build/petal-components/rules.md (hex dep, the @source/@import lines in assets/css/app.css, `use PetalComponents` in the web module, spread the bundled JS hooks).
2. Add this to assets/css/app.css:
:root { color-scheme: light; }
.dark { color-scheme: dark; }
@theme inline {
--color-primary-50: light-dark(var(--color-gray-50), var(--color-gray-900));
--color-primary-100: light-dark(var(--color-gray-100), var(--color-gray-700));
--color-primary-200: light-dark(var(--color-gray-200), var(--color-gray-800));
--color-primary-300: light-dark(var(--color-gray-300), var(--color-gray-300));
--color-primary-400: light-dark(var(--color-gray-400), var(--color-gray-600));
--color-primary-500: light-dark(var(--color-gray-600), var(--color-gray-400));
--color-primary-600: light-dark(var(--color-gray-900), var(--color-gray-50));
--color-primary-700: light-dark(var(--color-gray-800), var(--color-gray-200));
--color-primary-800: light-dark(var(--color-gray-700), var(--color-gray-300));
--color-primary-900: light-dark(var(--color-gray-900), var(--color-gray-100));
--color-primary-950: light-dark(var(--color-gray-950), var(--color-gray-50));
}
:root {
--pc-button-solid-fg: light-dark(#ffffff, var(--color-gray-900));
}
Then start the server and confirm headings, body text and code render in the chosen look.
Typography
The refined 4.2 scale: self-composing vertical rhythm, balanced
headings, and a three-tier emphasis system that holds in both modes.
Type tokens
Everything on this page follows the type
dials in the strip above: three opt-in tokens
(--pc-font-heading, --pc-font-body,
--pc-font-mono) that the library reads but never defines,
so an app that sets nothing keeps its own stack. Heading falls back through body,
so one body token restyles everything.
Dial in a look, then share the URL - the theme travels in the query string.
Headings
The quick brown fox
The quick brown fox
The quick brown fox
The quick brown fox
The quick brown fox
Body and emphasis tiers
A lead paragraph sits between heading and body - one size up, muted a step.
Default body copy carries the middle emphasis tier. It pairs
inline_code
with strong text
at the top tier, and stays readable
across light and dark without per-mode overrides.
Muted text is the quiet tier - captions, hints, timestamps.