Re is out: see what's new Lifetime updates on every purchase Support replies within 24 hours Secure checkout via Gumroad 8,500+ sales since 2016

↑↓ Navigate ↵ Open Esc Close

All products
Re:Maily contact form builder is now available on WordPress.org See it live

Restyle with CSS

Updated 3 min read 20 views

The built-in styles take their colors, corners and spacing from CSS variables. Their rules have no specificity, so you never need !important. There are two levels: tokens change every style at once, and style variables change one style.

/* Every style: Forma's highlight color */
:root {
	--forma-brand: #6d5cff;
}

/* One style: square cards with larger titles */
.forma--skin-default {
	--forma-skin-default--radius: 0;
	--forma-skin-default--title-font-size: 22px;
}

/* One layout: in that layout's Custom CSS */
selector {
	--forma-skin-fade--overlay-background: rgba(0, 0, 0, .6);
}

Tokens

Set them anywhere, for example on :root, or on a dark section so its grids turn dark too.

TokenUsed forDefault
--forma-surfaceCards, chips, page buttons#fff
--forma-surface-altCount badges, the progress track, an empty image#e9e6e0
--forma-line / --forma-line-strongHairlines; borders on hover#d6d2c9 / #8a867e
--forma-ink / --forma-ink-mutedText; meta, counts, summaries#161614 / #5e5b55
--forma-ink-inverseText on an ink fill (active chip, current page)#f4f2ee
--forma-brand / --forma-on-brandForma’s color (highlights, focus rings) and the text on it#ff5a3c / #fff
--forma-radius-sm / -md / -lgBadges; card media; card frame10px / 16px / 24px
--forma-shadowA card on hovera soft drop shadow
--forma-easeThe easing of hover and entrance movementscubic-bezier(.2, .7, .2, 1)

There is no font token. Every style uses the theme’s font, and the card styles take the theme’s text color, so a card looks like the rest of the theme with Forma’s color as the highlight.

Style variables

Each is named --forma-{kind}-{style}--{name} and defaults to the tokens. Set it on the style’s scope or anything inside it.

StyleScopeVariables (after --forma-{kind}-{style}--)
Default skin.forma--skin-defaultradius, card-padding, card-background, card-border-color, card-border-color-hover, card-shadow-hover, card-lift-hover, media-background, media-radius, zoom, filter, content-x, body-padding, body-gap, meta-color, meta-font-size, title-font-size, title-line-height, tag-color, tag-border-color, tag-radius, arrow-size, arrow-color, arrow-background, dot-color, dot-color-active, focus-color, nav-* (slider arrows)
Fade skin.forma--skin-faderadius, card-background, zoom, filter, overlay-background, overlay-padding, content-x, content-y, text-color, meta-color, meta-font-size, title-font-size, tag-background, tag-border-color, focus-color
Filter chips.forma__filtersgap, count-color, count-background, count-color-active, count-background-active, chip-*
Filter dropdown.forma__filtersselect-*
Search.forma__searchwidth, icon-color, placeholder-color, border-color-focus, spinner-color, spinner-track, field-*
Sort buttons.forma__sortgap, option-*
Sort dropdown.forma__sortselect-*
Pagination.forma__paginationcount-color, count-color-strong, progress-height, progress-color, progress-track, button-height, button-color, button-background, button-radius, button-done-color, button-done-background, focus-color, page-*

All nine card styles work this way. Each lists its variables in templates/skins/{style}/_variables.scss, and its settings in the Skin section set them for one layout.

Pills

Every pill (chip-, select-, field-, option-, page-, nav-) has the same set of variables: height, font-size, font-weight, color, background, border-color, border-color-hover, radius, color-active, background-active, focus-color.

.forma__filters {
	--forma-filter-default--chip-height: 38px;
	--forma-filter-default--chip-radius: 4px;
}

Turn off Forma’s CSS

To style everything in your theme, return false from forma_default_styles, for everything or for one kind of style:

// No Forma CSS at all
add_filter( 'forma_default_styles', '__return_false' );

// Keep the controls' look, drop the card styles'
add_filter( 'forma_default_styles', fn( $load, $kind ) => 'skins' !== $kind, 10, 2 );
Was this article helpful?