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

VariableDefaultUse
--ps-background#f6f7f9Page/navigation background
--ps-ink#172330Main text
--ps-body#465564Supporting text
--ps-accent#125cb0Links, focus and accents
--ps-on-accent#fffText on primary actions; dark default #151d27
--ps-section-standard#fffStandard surface
--ps-section-muted#e8edf3Muted surface
--ps-radius18pxSurface/media/control rounding
--ps-font-familysystem-ui, sans-serifShared typography
--ps-content-max1536pxCanonical metadata; not a theme override
--ps-narrow-max780pxNarrow sections
--ps-bordercolor-mix(in srgb, var(--ps-ink) 18%, transparent)Borders
--ps-navigation-shadow0 4px 8px rgb(0 0 0 / 12%)Header and satellite elevation; none disables it
--ps-scroll-offset1rem fallbackSection anchor scroll margin
--ps-section-width100% fallbackSection 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:

GridminWidthcolumnsgapheadlineSizeheadlineLineHeightbodySizebodyLineHeightheadlineGap
xs0412182814208
s600616182814208
m8408162032142012
l120012242440162416

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.

GroupValues and consumers
contentMax1536; numeric content cap and generated CSS default
layoutMinWidthsxs=0, s=600, m=840, l=1200, xl=1600, 2xl=1809, 3xl=2300; viewport classification and selected CSS rules
gridFour rows in the complete table above; numeric grid and generated CSS
xlContentInset136; each side's generated inset between xl and 2xl
cardTextInsetinline=12, block=12; used by core and catalog CSS
cardMediaInset8; contained-media inset; cover uses zero
menuheight=66, wideHeight=64, wideTop=16, scrollThreshold=112; generated header dimensions and delayed scrolling
satellitewidth=80, height=40, inset=28, top=28; generated dimensions and positions

cards contains:

SizespantitleSizetitleWeighteyebrowSizeeyebrowWeightlineHeightrowsgridSSpan
s2125000400182Absent
m21450012400202Absent
l418500144002433

These feed resolveCardLayout and Svelte catalog cards; editorial cards use content typography. breadcrumb contains:

Viewport sizefontSizeheight
xs1024
s1024
m1230
l1440
xl1440
2xl1440
3xl1440

Breadcrumbs consumes these generated viewport sizes and minimum heights, allowing wrapping to grow beyond the minimum. Navigation consumes the generated menu and satellite geometry.

ts
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.

VariablesMeaning
--ps-menu-height, --ps-menu-top, --ps-nav-height66/0/66 below XL; 64/16/80 from XL
--ps-sticky-range112px delayed-scroll interval
--ps-satellite-width, --ps-satellite-height, --ps-satellite-inset, --ps-satellite-top80px, 40px, 28px, 28px
--ps-breadcrumb-font-size, --ps-breadcrumb-heightViewport values in the table above
--ps-card-large-span3 in the S grid, otherwise 4
--ps-card-spanCurrent catalog span
--ps-card-title-size, --ps-card-title-weightCatalog title typography
--ps-card-eyebrow-size, --ps-card-eyebrow-weightCatalog eyebrow typography
--ps-card-line-height, --ps-card-text-rowsCatalog line height and title-only row budget
--ps-card-media-aspectSelected mediaAspect; defaults to 3/2
--ps-card-media-inset8px contained-media inset; cover uses zero
--ps-card-text-inset-inline, --ps-card-text-inset-block12px each
--ps-spacing-factornone/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.