Surfaces
A surface is a set of inherited UI tokens (--pm-sf-*). Components only read these tokens, so every component supports every surface automatically.
flat
Solid surfaces, hairline borders, soft elevation. The default.
outline
Transparent fills with strong 3:1 borders. Great for dense tools.
gradient
OKLCH gradients from the accent and secondary hues, with a sheen on solid controls.
glass
Backdrop blur, translucent tint and a specular edge. Falls back to opaque with prefers-reduced-transparency or without blur support.
neumorphic
Dual light/dark shadows from the canvas colour. Always keeps a visible boundary for WCAG 1.4.11.
Controls
Nothing about a surface is fixed. Where the light comes from, how far, soft and dark shadows are, how wide borders are, and what glass, gradient and neumorphic surfaces are made of: each is a control you set, or leave to the theme. Try them:
Three ways to set them
In the theme, for the whole app. The generator has the same sliders and writes this for you:
In CSS, on the root or on anything that has data-surface (or a component's surface). The nearest one wins, so one card or one section can differ from the rest:
By the people who use your app, saved with their other display choices. This site's Display settings do it this way (Fine-tune):
Every control
| In a theme | Custom property | What it does | Range | When not set |
|---|---|---|---|---|
shadow.angle | --pm-light-angle | Where the light comes from: 0 is above (shadows fall straight down), 90 from the right, 315 from the top left. Shadows, glass and gloss highlights follow it. | 0 to 360 deg | 0deg (neumorphic: 315deg) |
shadow.depth | --pm-shadow-depth | How far shadows reach: 1 as designed, 0 no shadows, 2 twice as far. | 0 to 3 | 1 |
shadow.softness | --pm-shadow-softness | How much shadows blur: 1 as designed, 0 a hard edge. | 0 to 3 | 1 |
shadow.strength | --pm-shadow-strength | How dark shadows are: 1 as designed, 0 invisible. | 0 to 3 | 1 |
border.width | --pm-border-width | The line around surfaces, fields and controls, in pixels. | 0 to 4 px | 1px |
glass.blur | --pm-glass-blur | How much the glass blurs what is behind it. glass only. | 0 to 60 px | 18px |
glass.opacity | --pm-glass-opacity | How much of the glass is its own colour: 100 is solid. glass only. | 0 to 100 % | 58% |
glass.saturation | --pm-glass-saturation | How vivid the colours behind the glass become: 100 leaves them as they are. glass only. | 100 to 300 % | 170% |
glass.sheen | --pm-glass-sheen | The highlight across the glass: 1 as designed, 0 none. glass only. | 0 to 3 | 1 |
glass.edge | --pm-glass-edge | How bright the rim of the glass is: 1 as designed, 0 none. glass only. | 0 to 3 | 1 |
glass.backdrop | --pm-glass-backdrop | How much colour the page behind the glass carries: 1 as designed, 0 a plain page. glass only. | 0 to 3 | 1 |
gradient.angle | --pm-gradient-angle | The direction the gradient runs in, like a CSS gradient: 180 runs down, 90 to the right. gradient only. | 0 to 360 deg | 150deg |
gradient.strength | --pm-gradient-strength | How much colour the gradient carries: 1 as designed, 0 none. gradient only. | 0 to 1.3 | 1 |
gradient.sheen | --pm-gradient-sheen | The gloss on buttons and other solid fills: 1 as designed, 0 none. gradient only. | 0 to 3 | 1 |
neumorphic.highlight | --pm-neu-highlight | How bright the lit edge is: 1 as designed, 0 none. Shadow strength sets the shaded edge. neumorphic only. | 0 to 3 | 1 |
neumorphic.curve | --pm-neu-curve | The shape of the face: 0 flat, 1 rounded out (convex), -1 hollowed (concave). neumorphic only. | -1 to 1 | 0 |
shadow.color | --pm-shadow-ink | The colour shadows are made of. Strength decides how much of it shows. | any colour | a dark tone of the neutral hue, black in dark mode |
glass.tint | --pm-glass-tint | The colour of the glass. glass only. | any colour | the surface colour |
gradient.from | --pm-gradient-from | The colour the gradient starts with. gradient only. | any colour | the soft accent colour |
gradient.to | --pm-gradient-to | The colour the gradient ends with. gradient only. | any colour | the soft secondary colour |
neumorphic.light | --pm-neu-light | The colour of the lit edge. neumorphic only. | any colour | white |
neumorphic.base | --pm-neu-base | The colour of the page and of everything made from it. neumorphic only. | any colour | the canvas colour, a tone darker in light mode and lighter in dark mode |
Shadows are also three tokens you can read in your own CSS: --pm-shadow-x and --pm-shadow-y (the direction, times the depth) and --pm-shadow-blur. Every elevation (--pm-elevation-1 to 5) is built from them, so your own shadows can follow the same light.
A border narrower than one pixel, or shadows with no strength, can leave a surface without a visible edge. The defaults meet WCAG 1.4.11; check contrast again when you go below them.
Usage
A surface set on the whole app draws the page too: the colour behind glass, the tone neumorphic is made of. A region with a surface of its own keeps the page it is on; add class="pm-surface-page" to give it that surface's page.
What follows the surface
Everything a component paints is one of the roles below, and every surface defines every role. The page, the app shell (sidebar, app bar, tab bar), cards, tables, fields, tracks, menus and dialogs all read them, so one attribute changes the whole app. Colours that carry meaning stay as they are: tone fills (badges, alerts, status), text, icons and chart ink.
| Token | What it paints |
|---|---|
--pm-sf-page | The page: the colour everything sits on. |
--pm-sf-page-image | A layer over the page colour (what shows through glass), or none. |
--pm-sf-bg | A container: card, panel, table, list. |
--pm-sf-image | A layer over a container (gradient, sheen, curve), or none. |
--pm-sf-border | The line around a container, bar or floating layer. |
--pm-sf-shadow | The shadow of a container. |
--pm-sf-lift-1 | The shadow of a container with elevation="1": the lowest. |
--pm-sf-lift-2 | The shadow with elevation="2". |
--pm-sf-lift-3 | The shadow with elevation="3". |
--pm-sf-lift-4 | The shadow with elevation="4". |
--pm-sf-lift-5 | The shadow with elevation="5": the highest. |
--pm-sf-backdrop | The backdrop-filter of a container, or none. |
--pm-sf-opaque | A container colour that hides what scrolls under it: sticky headers, pinned columns, rings around avatars and badges. |
--pm-sf-subtle | A quiet fill inside a container: table head, group row, footer. |
--pm-sf-well | A recessed track or chip: segmented control, progress track, skeleton, inline code. |
--pm-sf-well-shadow | The shadow of a recessed track (pressed in on neumorphic, a ring on outline), or none. |
--pm-sf-neutral | The fill of neutral things that carry no tone: a neutral badge or button, an avatar, a count. |
--pm-sf-hover | The fill under the pointer on rows, items and quiet buttons. |
--pm-sf-active | The fill while such a row or item is pressed. |
--pm-sf-region-bg | A bar or side panel at the edge of the page: app bar, sidebar, tab bar. |
--pm-sf-region-shadow | The shadow of a bar or side panel, and of a panel that sits in a container (table, list box, choice card), or none. |
--pm-sf-region-backdrop | The backdrop-filter of a bar or side panel, or none. |
--pm-sf-float-bg | A layer above the page: menu, popover, dialog, drawer, toast, tooltip card. |
--pm-sf-float-shadow | The shadow of a layer above the page. |
--pm-sf-float-backdrop | The backdrop-filter of a layer above the page, or none. |
--pm-sf-modal-shadow | The shadow of a modal layer over the dimmed page (dialog, drawer, command palette, bottom sheet): on neumorphic a crisp bevel and drop shadow, as the light shadow of a raised piece would glow on the dim. |
--pm-sf-control-bg | A text field or select. |
--pm-sf-control-border | The line around a field (3:1 against the page). |
--pm-sf-control-shadow | The shadow of a field, a drop zone or an empty slot (pressed in on neumorphic), or none. |
--pm-sf-raise-bg | The face of a raised piece: switch and slider thumb, the selected segment or pill. |
--pm-sf-raise | The shadow of a raised piece or button. |
--pm-sf-press | The shadow of a button while pressed. |
--pm-sf-line-raise | The shadow of a small piece that is flat on other surfaces (outline and ghost button, badge, tag, key, toggle, step, chat bubble, timeline marker, today in a calendar): raised where every piece is, none where its line or fill is enough. |
--pm-sf-line-press | The same piece while pressed or on (a pressed toggle, the chosen day), or none. |
--pm-sf-hover-shadow | The shadow of a row, option or item under the pointer or the keyboard (menu, list box, table row, nav item): it rises on neumorphic, or none where the hover fill is enough. |
--pm-sf-groove | The colour of a dividing line: the border colour, or on neumorphic the shaded edge, so with sf-groove-lit under it the line is cut into the surface. |
--pm-sf-groove-lit | The lit edge under a dividing line, which engraves it into the surface (neumorphic), or transparent. |
--pm-sf-mark-filter | A filter on drawn marks (chart bars, lines and slices, sparklines): none, or on neumorphic a soft lit and shaded edge that lifts them off the page. |
--pm-sf-mark-track | Whether a chart draws the slot each bar rises in: 1 on neumorphic (pressed into the surface), 0 elsewhere. |
--pm-sf-bezel | The shadow of a small round indicator (a status dot): none, or on neumorphic a raised ring of the surface around it. |
--pm-sf-track-min | The least height of a thin track (progress, meter, slider), so its groove reads on neumorphic; 0px elsewhere. |
--pm-sf-joined-shadow | The shadow of a piece inside a joined group (button group): initial keeps the piece's own shadow (read as var(--pm-sf-joined-shadow, <own>)); on neumorphic the group rises as one, so its pieces have none and their seams stay flat. |
--pm-sf-solid-image | A layer over solid colour fills (gloss), or none. |
--pm-sf-soft-mix | How much of a soft tone fill is its own colour (less on glass). |
In your own CSS, paint with these instead of a fixed colour and your components follow the surface too:
To create your own surface, define every token of the table under a selector such as [data-surface="paper"]. In TypeScript, Record<SurfaceToken, string> from @prismora/theme tells you when one is missing.