Every style option is also a custom property (--pm-shadow-depth, --pm-light-angle, --pm-border-width…) that you can set on any section, and that the people who use your app can change and save. The surfaces guide lists them all with a live playground.
Selecting modes and themes
Markup
Effect
(nothing)
Follows the OS light/dark preference.
data-mode="light|dark"
Forces a scheme for that element and its subtree.
data-theme="ocean"
Switches to a named theme for that subtree.
Both nest, and the nearest one wins: a data-mode="dark" card inside a light page renders dark, including all its components.
Page theme
Forced dark
Sunset theme
Forest · dark
Runtime theming
Generate and apply a theme in the browser, for example when users pick their own brand colour:
A change of mode or theme plays out as a View Transition. The visitor's choice is saved with their other
preferences (Display settings on this site offers it): fade cross-fades, circle grows from
where they clicked (or the focused control), wipe sweeps across in the reading direction, prism crosses diagonally while the new colours refract into place, blur focuses from the
old view into the new, and none changes at once. Without a choice it is circle after a
click and fade otherwise. Nothing moves under reduced motion, or with data-motion at reduced or none; browsers without View Transitions change at once.
import { THEME_TRANSITIONS, ThemeController } from '@prismora/theme';
const theme = new ThemeController();
theme.set({ transition: 'prism' }); // one of THEME_TRANSITIONS, or null for the default
Component defaults
Set default props for every instance of a component, globally or per subtree:
/* CSS: any subtree can change the default */
.marketing { --pm-default-button-variant: soft; }