CSS variables
Every color, size and spacing is a --pico-* custom property. Override one in your own CSS, on the page or on a single element.
On this page
Pico Reforged keeps its design values in CSS custom properties. They all start with --pico-, and the names are the same as in Pico CSS v2.1.1 by Lucas Larroche, so an old override keeps working. Change a variable and every rule that reads it follows.
Most customization needs no build step. Write the override in your own stylesheet, after the Pico link.
Override a variable
Declare the variable on :root to change it for the whole page.
:root {
--pico-border-radius: 0;
--pico-font-family: Georgia, serif;
--pico-spacing: 0.75rem;
}Unlayered CSS wins
Your CSS is not inside a cascade layer, so it wins over Pico without !important or a heavier selector. See Cascade layers and overriding.
Scope a change to one element
A variable set on an element applies to that element and everything inside it.
<article style="--pico-border-radius: 1.5rem; --pico-primary-background: oklch(0.55 0.2 25); --pico-primary-border: oklch(0.55 0.2 25); --pico-primary-hover-background: oklch(0.48 0.2 25); --pico-primary-hover-border: oklch(0.48 0.2 25);">
<h3>A rounder card with a red button</h3>
<p>The rest of the page keeps its defaults.</p>
<button>Primary</button>
</article>
<article>
<h3>A regular card</h3>
<p>Same page, no overrides.</p>
<button>Primary</button>
</article>Variables resolve where they are declared
--pico-block-spacing-vertical is declared on :root as calc(var(--pico-spacing) , so setting --pico-spacing on a single <article> does not change it. Set --pico-block-spacing-vertical and its horizontal sibling on the element instead.
Some elements set their own values. Headings set --pico-font-size and --pico-line-height per level (for example h1 ), and buttons set --pico-background-color and --pico-border-color from the primary, secondary and contrast tokens. To change a heading size, write the rule on the heading, not on :root.
h1 {
--pico-font-size: 2.5rem;
}Reference
Type in the field to filter every list on this page by name or description. Defaults and swatches are read from the build, so they match the current release.
Typography
--pico-font-family- Font stack of the page.
--pico-font-family-sans-serif- The system sans-serif stack, with the emoji stack at the end.
--pico-font-family-monospace- Stack for code, kbd, samp and pre.
--pico-font-family-emoji- Emoji fonts, appended to the other stacks.
--pico-font-size- Root font size. It takes one step to 106.25% from 1536px. Headings override it per level.
--pico-font-weight- Body font weight.
--pico-line-height- Body line height.
--pico-text-underline-offset- Offset of link underlines.
--pico-typography-spacing-vertical- Space under paragraphs, lists and headings.
--pico-form-label-font-weight- Font weight of form labels.
To change the font, set --pico-font-family and nothing else.
<style>
:root {
--pico-font-family: Georgia, "Times New Roman", serif;
--pico-line-height: 1.65;
}
</style>
<h3>Set in Georgia</h3>
<p>One variable changes the font of every element, forms and buttons included.</p>
<button>Button</button>Borders, transitions and spacing
--pico-border-radius- Corner radius of buttons, inputs and code blocks. Small parts such as checkboxes and tooltips use a fraction of it.
--pico-card-border-radius- Corner radius of cards, modals, menus, popovers and the extras surfaces. 1.5 times
--pico-border-radius; the modal box uses 4/3 of it. --pico-border-width- Width of borders.
--pico-outline-width- Width of focus rings.
--pico-transition- Timing of hover and focus transitions. A build with transitions turned off sets it to 0s.
--pico-spacing- Base spacing unit.
--pico-block-spacing-vertical- Vertical padding of cards and modals. Larger from 576px up when the responsive spacings option is on.
--pico-block-spacing-horizontal- Horizontal padding of the same blocks.
--pico-grid-column-gap- Column gap of .grid.
--pico-grid-row-gap- Row gap of .grid.
--pico-form-element-spacing-vertical- Vertical padding of inputs, selects, textareas and buttons.
--pico-form-element-spacing-horizontal- Horizontal padding of the same elements.
--pico-form-element-disabled-opacity- Opacity of disabled form elements.
--pico-loading-spinner-opacity- Opacity of the aria-busy spinner.
Container
--pico-container-max-width- Max width of .container and the semantic container. Set per breakpoint: 510px from 576px, 700px from 768px, 950px from 1024px, 1200px from 1280px and 1450px from 1536px.
The fluid builds set it to 100% at every width. See Building a custom bundle.
Navigation
--pico-nav-element-spacing-vertical- Vertical padding of nav items.
--pico-nav-element-spacing-horizontal- Horizontal padding of nav items.
--pico-nav-link-spacing-vertical- Vertical padding of nav links.
--pico-nav-link-spacing-horizontal- Horizontal padding of nav links.
--pico-nav-breadcrumb-divider- Divider between breadcrumb items.
Modal
--pico-modal-overlay-backdrop-filter- Backdrop filter behind an open dialog.
--pico-scrollbar-width- Right padding added to html while .modal-is-open is set, so a hidden scrollbar does not shift the page. Set it from a script if you need it.
Shadows
--pico-box-shadow- The soft layered shadow behind cards and dropdowns. Its colors use light-dark().
--pico-card-box-shadow- Shadow of cards.
--pico-dropdown-box-shadow- Shadow of dropdown menus.
--pico-button-box-shadow- Resting shadow of buttons. Empty by default.
--pico-button-hover-box-shadow- Shadow of buttons on hover. Empty by default.
--pico-group-box-shadow- Shadow of a role="group" container.
--pico-switch-thumb-box-shadow- Shadow of the switch thumb. Part of a theme.
Icons
The icons are SVG data URIs, so you can swap one for your own.
--pico-icon-checkbox- Checkmark in checked checkboxes.
--pico-icon-minus- Dash in indeterminate checkboxes.
--pico-icon-chevron- Arrow of selects, accordions and dropdown summaries.
--pico-icon-date- Date input icon.
--pico-icon-time- Time input icon.
--pico-icon-search- Search input icon.
--pico-icon-close- Close button of modals.
--pico-icon-loading- Spinner shown by aria-busy="true".
--pico-icon-valid- Icon of an input with aria-invalid="false". It has a light and a dark version.
--pico-icon-invalid- Icon of an input with aria-invalid="true". It has a light and a dark version.
Colors
The semantic color tokens are written once with light-dark(), so each holds a light and a dark value. In the tables below the first value is the light scheme and the second the dark one. A single value, or a var(), means both schemes use it. Hex values are approximations of the OKLCH colors in the source. How the schemes switch is explained in Color schemes.
The primary tokens belong to the theme. The values shown are for Azure, the default. Another theme replaces them, see Themes.
Page
--pico-background-color- Page background color.
--pico-color- Default text color.
--pico-muted-color- Muted text color for secondary information.
--pico-muted-border-color- Border color of separators and quiet surfaces.
Primary
--pico-primary- Primary text and link color.
--pico-primary-background- Primary fill color.
--pico-primary-border- Primary border color.
--pico-primary-underline- Primary link underline color.
--pico-primary-hover- Primary hover color.
--pico-primary-hover-background- Primary hover fill color.
--pico-primary-hover-border- Primary hover border color.
--pico-primary-hover-underline- Primary hover link underline color.
--pico-primary-focus- Primary focus ring color.
--pico-primary-inverse- Primary text color on a filled background.
--pico-text-selection-color- Background of selected text.
Secondary
--pico-secondary- Secondary text and link color.
--pico-secondary-background- Secondary fill color.
--pico-secondary-border- Secondary border color.
--pico-secondary-underline- Secondary link underline color.
--pico-secondary-hover- Secondary hover color.
--pico-secondary-hover-background- Secondary hover fill color.
--pico-secondary-hover-border- Secondary hover border color.
--pico-secondary-hover-underline- Secondary hover link underline color.
--pico-secondary-focus- Secondary focus ring color.
--pico-secondary-inverse- Secondary text color on a filled background.
Contrast
--pico-contrast- Contrast text and link color.
--pico-contrast-background- Contrast fill color.
--pico-contrast-border- Contrast border color.
--pico-contrast-underline- Contrast link underline color.
--pico-contrast-hover- Contrast hover color.
--pico-contrast-hover-background- Contrast hover fill color.
--pico-contrast-hover-border- Contrast hover border color.
--pico-contrast-hover-underline- Contrast hover link underline color.
--pico-contrast-focus- Contrast focus ring color.
--pico-contrast-inverse- Contrast text color on a filled background.
Headings and text
--pico-h1-color- Color of h1.
--pico-h2-color- Color of h2.
--pico-h3-color- Color of h3.
--pico-h4-color- Color of h4.
--pico-h5-color- Color of h5.
--pico-h6-color- Color of h6.
--pico-mark-background-color- Mark element.
--pico-mark-color- Mark element.
--pico-ins-color- Ins and del elements.
--pico-del-color- Ins and del elements.
--pico-blockquote-border-color- Blockquote element.
--pico-blockquote-footer-color- Blockquote element.
--pico-code-background-color- Background of inline code, kbd and samp, and of code blocks.
--pico-code-color- Text color of inline code and samp, and of code blocks.
--pico-code-kbd-background-color- Background of
kbd, a key or shortcut. --pico-code-kbd-color- Text color of
kbd. --pico-table-border-color- Table.
--pico-table-row-stripped-background-color- Table.
Form elements
--pico-form-element-background-color- Form element color.
--pico-form-element-selected-background-color- Form element color.
--pico-form-element-border-color- Form element color.
--pico-form-element-color- Form element color.
--pico-form-element-placeholder-color- Form element color.
--pico-form-element-active-background-color- Form element color.
--pico-form-element-active-border-color- Form element color.
--pico-form-element-focus-color- Form element color.
--pico-form-element-invalid-border-color- Form element color in the invalid state.
--pico-form-element-invalid-active-border-color- Form element color in the invalid state.
--pico-form-element-invalid-focus-color- Form element color in the invalid state.
--pico-form-element-valid-border-color- Form element color in the valid state.
--pico-form-element-valid-active-border-color- Form element color in the valid state.
--pico-form-element-valid-focus-color- Form element color in the valid state.
--pico-switch-background-color- Switch control.
--pico-switch-checked-background-color- Switch control.
--pico-switch-color- Switch control.
--pico-range-border-color- Range input.
--pico-range-active-border-color- Range input.
--pico-range-thumb-border-color- Range input.
--pico-range-thumb-color- Range input.
--pico-range-thumb-active-color- Range input.
Components
--pico-accordion-border-color- Accordion summary.
--pico-accordion-active-summary-color- Accordion summary.
--pico-accordion-close-summary-color- Accordion summary.
--pico-accordion-open-summary-color- Accordion summary.
--pico-card-background-color- Card surface.
--pico-card-border-color- Card surface.
--pico-card-sectioning-background-color- Card surface.
--pico-dropdown-background-color- Dropdown menu surface.
--pico-dropdown-border-color- Dropdown menu surface.
--pico-dropdown-color- Dropdown menu surface.
--pico-dropdown-hover-background-color- Dropdown menu surface.
--pico-modal-overlay-background-color- Modal overlay.
--pico-progress-background-color- Progress bar.
--pico-progress-color- Progress bar.
--pico-tooltip-background-color- Tooltip bubble.
--pico-tooltip-color- Tooltip bubble.
Color palette
The full OKLCH palette is not in pico.css. It lives in pico.colors.css, which defines --pico-color-<hue>-<step> for the 20 hues and the steps 50 to 950 in increments of 50, for example --pico-color-azure-550. A bare --pico-color-azure is the 550 step, and --pico-color-black and --pico-color-white are there too. The same file adds the .pico-color-* and .pico-background-* classes. Link it after pico.css.
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@rusticstack/pico-reforged@2/css/pico.colors.min.css"
/><p class="pico-color-red-550">Text in red 550, from a class.</p>
<p class="pico-background-jade-600" style="padding: 0.5rem 1rem;">A jade 600 background.</p>
<p style="color: var(--pico-color-amber-450);">Amber 450, read from the variable.</p>Extras
The opt-in extras declare their own tokens, named --pico-<extra>-*, for example --pico-tabs-indicator-color and --pico-badge-background-color. They are listed on the page of each extra, starting from Extras.