Skip to content

Theme contract

This page lists what a SightPress theme can rely on and must provide. It is generated from the sightpress/theme-interface package. To build a theme step by step, follow the Create a theme tutorial.

A theme is presentation only: design tokens, Twig templates, assets and translations. Anything with behaviour is a module.

theme.json

Key Required What it is
name Yes The theme id; must equal the id in the theme's manifest.
label Yes Name shown to people.
version Yes The theme's version (Semantic Versioning); must equal the version in the theme's manifest.
colors Yes The colours for light and dark mode, and optionally for more contrast.
typography Yes Fonts and text sizes.
spacing No The spacing scale.
radius No Corner radii.
focus No The focus outline.
contrast No Colour pairs core checks in every colour mode: text needs 4.5:1, interface colours 3:1 (WCAG 2.2 AA).
chart No Which of the theme's colours the data series of a chart use, in order; without it they use chart-1 to chart-4. Core checks each series colour for 3:1 and chart-text for 4.5:1 on background and surface in every colour mode.

Token groups

Each group becomes CSS custom properties with this prefix.

Group Prefix
typography --font-
spacing --space-
radius --radius-
focus --focus-

Charts use the colours chart-1, chart-2, chart-3, chart-4, chart-grid, chart-text.

Layouts

Id Name Required What it is
default Default Yes One column at a comfortable reading width.
home Home Yes An introduction band, then content at full page width.
search Search results Yes The search form and the list of results.
landing Landing No A wide introduction band, then content in full-width sections.
sidebar Sidebar No Content with a side column for related links and notes.
full-width Full width No Content across the whole page width, without a reading column.

Required templates

master.html.twig

Page shell every page extends. Sets lang and dir on from the page's language, includes the core partial, makes "Skip to main content" the first thing to tab to, and has the landmarks

,