CSS variables and tokens
CSS variables customize presentation; layoutTokens supplies canonical numeric values
for core calculations and generated grid CSS. Changing CSS does not mutate the token object. This
page distinguishes public theme controls, generated layout variables and implementation details.
Theme and component variables
| Variable | Default | Use |
|---|---|---|
--ps-background | #f6f7f9 | Page/navigation background |
--ps-ink | #172330 | Main text |
--ps-body | #465564 | Supporting text |
--ps-accent | #125cb0 | Links, focus and accents |
--ps-on-accent | #fff | Text on primary actions; dark default #151d27 |
--ps-section-standard | #fff | Standard surface |
--ps-section-muted | #e8edf3 | Muted surface |
--ps-radius | 18px | Surface/media/control rounding |
--ps-font-family | system-ui, sans-serif | Shared typography |
--ps-content-max | 1536px | Canonical metadata; not a theme override |
--ps-narrow-max | 780px | Narrow sections |
--ps-border | color-mix(in srgb, var(--ps-ink) 18%, transparent) | Borders |
--ps-navigation-shadow | 0 4px 8px rgb(0 0 0 / 12%) | Header and satellite elevation; none disables it |
--ps-scroll-offset | 1rem fallback | Section anchor scroll margin |
--ps-section-width | 100% fallback | Section width, also assigned by section.style.width |
Dark mode ([data-ps-theme='dark']) assigns background #151d27, ink #f2f5fa,
body #bdcbdc, accent #91baff, standard #202d3b and muted #28384a. Other variables retain
their values. The border is defined on :root; do not assume it is recomputed from every
descendant ink override. Set border explicitly when adapting a palette if needed.
Legacy card minimum-width and carousel-width variables were removed in 0.2. Catalog geometry is generated from the same tokens as core.
Generated grid variables
The ps-grid-scope class resolves the active container size. These generated values are read-only layout contracts, not theme inputs: --ps-grid-columns, --ps-grid-gap, --ps-grid-headline-size, --ps-grid-headline-line-height, --ps-grid-body-size, --ps-grid-body-line-height, --ps-grid-headline-gap. Legacy --ps-{size}-* inputs were removed. Defaults:
| Grid | minWidth | columns | gap | headlineSize | headlineLineHeight | bodySize | bodyLineHeight | headlineGap |
|---|---|---|---|---|---|---|---|---|
| xs | 0 | 4 | 12 | 18 | 28 | 14 | 20 | 8 |
| s | 600 | 6 | 16 | 18 | 28 | 14 | 20 | 8 |
| m | 840 | 8 | 16 | 20 | 32 | 14 | 20 | 12 |
| l | 1200 | 12 | 24 | 24 | 40 | 16 | 24 | 16 |
All dimensional values are CSS pixels. Change canonical layoutTokens plus the generator and parity tests when revising geometry; overriding columns/gaps only in a host stylesheet breaks the shared contract.
Internal resolved variables
ContentBlock writes --ps-content-block-span-xs, --ps-content-block-span-s, --ps-content-block-span-m, --ps-content-block-span-l; container rules select --ps-content-block-span. Configure the span prop instead of overriding these.
SectionSurfaceGroup writes --ps-section-top-radius and --ps-section-bottom-radius, using var(--ps-radius) or 0px. Ungrouped surfaces
default to 0px. Image uses private --image-ratio and --image-fit variables;
configure ImageData instead.
Complete numeric token groups
layoutTokens is exported from core; no JSON deep import is required. The groups below
describe its entire structure. Treat it as canonical read-only configuration in application code;
there is no reactive theme API for mutating it.
| Group | Values and consumers |
|---|---|
contentMax | 1536; numeric content cap and generated CSS default |
layoutMinWidths | xs=0, s=600, m=840, l=1200, xl=1600, 2xl=1809, 3xl=2300; viewport classification and selected CSS rules |
grid | Four rows in the complete table above; numeric grid and generated CSS |
xlContentInset | 136; each side's generated inset between xl and 2xl |
cardTextInset | inline=12, block=12; used by core and catalog CSS |
cardMediaInset | 8; contained-media inset; cover uses zero |
menu | height=66, wideHeight=64, wideTop=16, scrollThreshold=112; generated header dimensions and delayed scrolling |
satellite | width=80, height=40, inset=28, top=28; generated dimensions and positions |
cards contains:
| Size | span | titleSize | titleWeight | eyebrowSize | eyebrowWeight | lineHeight | rows | gridSSpan |
|---|---|---|---|---|---|---|---|---|
| s | 2 | 12 | 500 | 0 | 400 | 18 | 2 | Absent |
| m | 2 | 14 | 500 | 12 | 400 | 20 | 2 | Absent |
| l | 4 | 18 | 500 | 14 | 400 | 24 | 3 | 3 |
These feed resolveCardLayout and Svelte catalog cards; editorial cards use content
typography. breadcrumb contains:
| Viewport size | fontSize | height |
|---|---|---|
| xs | 10 | 24 |
| s | 10 | 24 |
| m | 12 | 30 |
| l | 14 | 40 |
| xl | 14 | 40 |
| 2xl | 14 | 40 |
| 3xl | 14 | 40 |
Breadcrumbs consumes these generated viewport sizes and minimum heights, allowing wrapping to grow beyond the minimum. Navigation consumes the generated menu and satellite geometry.
import { layoutTokens } from '@page-sections/core';
console.log(layoutTokens.grid.m.columns, layoutTokens.grid.m.gap); // 8, 16 Related: Themes and Styling, Responsive Layout and Breakpoints, Core API.
Generated component variables
These variables are implementation outputs. Configure component props or canonical tokens instead of assigning them in a host theme.
| Variables | Meaning |
|---|---|
| --ps-menu-height, --ps-menu-top, --ps-nav-height | 66/0/66 below XL; 64/16/80 from XL |
| --ps-sticky-range | 112px delayed-scroll interval |
| --ps-satellite-width, --ps-satellite-height, --ps-satellite-inset, --ps-satellite-top | 80px, 40px, 28px, 28px |
| --ps-breadcrumb-font-size, --ps-breadcrumb-height | Viewport values in the table above |
| --ps-card-large-span | 3 in the S grid, otherwise 4 |
| --ps-card-span | Current catalog span |
| --ps-card-title-size, --ps-card-title-weight | Catalog title typography |
| --ps-card-eyebrow-size, --ps-card-eyebrow-weight | Catalog eyebrow typography |
| --ps-card-line-height, --ps-card-text-rows | Catalog line height and title-only row budget |
| --ps-card-media-aspect | Selected mediaAspect; defaults to 3/2 |
| --ps-card-media-inset | 8px contained-media inset; cover uses zero |
| --ps-card-text-inset-inline, --ps-card-text-inset-block | 12px each |
| --ps-spacing-factor | none/tight/normal/loose/spacious = 0/0.5/1/2/4 |
Derived syntax colors
--ps-code-light and --ps-code-dark are per-token values emitted by CodeBlock
from its optional highlighted input. They are presentation internals, not global theme settings.
Code surfaces use the existing standard/muted palette and border/radius tokens.
Selection surface
--ps-selection optionally customizes the selected navigation and button-group surface.
When absent, it falls back to --ps-section-muted. The website uses bergjohann-com's neutral grey
selection and green-teal accent palette; the package's default theme remains independent.