Variables

µCSS exposes all its design tokens as CSS variables (--mu-*) defined on :root. Override any variable to customize the framework without modifying the source files.

Typography #

DescriptionVariableDefault
Sans-serif font stack--mu-font-family-sans-serifsystem-ui, "Segoe UI",
Roboto, Helvetica,
Arial, sans-serif
Monospace font stack--mu-font-family-monospaceui-monospace, SFMono-Regular,
"SF Mono", Menlo,
Consolas, monospace
Active font--mu-font-familyvar(--mu-font-family-sans-serif)
Base size (responsive: 106.25% to 131.25%)--mu-font-size100%
Normal weight--mu-font-weight400
Line height--mu-line-height1.5
Underline offset--mu-text-underline-offset0.1rem

Responsive sizing #

The base font size increases at each breakpoint:

Breakpoint--mu-font-size
< 576px100%
≥ 576px106.25%
≥ 768px112.5%
≥ 1024px118.75%
≥ 1280px125%
≥ 1536px131.25%

Spacing #

DescriptionVariableDefault
Base unit (padding, margins)--mu-spacing1rem
Typographic vertical spacing--mu-typography-spacing-vertical1rem
Vertical spacing between sections--mu-block-spacing-verticalvar(--mu-spacing)
Horizontal spacing between sections--mu-block-spacing-horizontalvar(--mu-spacing)
Grid column gutter--mu-grid-column-gapvar(--mu-spacing)
Grid row gutter--mu-grid-row-gapvar(--mu-spacing)

Borders and outlines #

DescriptionVariableDefault
Corner rounding--mu-border-radius0.25rem
Border thickness (1px)--mu-border-width0.0625rem
Focus outline thickness (2px)--mu-outline-width0.125rem

Transitions #

DescriptionVariableDefault
Animation duration and easing--mu-transition0.2s ease-in-out

Forms #

DescriptionVariableDefault
Vertical padding of fields--mu-form-element-spacing-vertical0.75rem
Horizontal padding of fields--mu-form-element-spacing-horizontal1rem
Field border--mu-form-element-border-color#cfd5e2
Border on focus--mu-form-element-active-border-colorvar(--mu-primary-border)
Opacity of disabled fields--mu-form-element-disabled-opacity0.5

Base colors #

These variables change between light and dark themes (see Dark mode).

DescriptionVariableLightDark
Page background--mu-background-color#fffrgb(19, 22.5, 30.5)
Main text--mu-color#373c44#c2c7d0
Secondary text--mu-muted-color#646b79#8891a4
Subtle borders--mu-muted-border-colorrgb(231, 234, 239.5)rgb(48, 54.5, 69)
Selection highlight--mu-text-selection-colorrgba(2, 154, 232, 0.25)rgba(1, 170, 255, 0.1875)
Inverted background (always opposite of page)--mu-inverted-background#181c25#eff1f4
Inverted text (always opposite of page)--mu-inverted-color#fff#000

Role colors #

11 color roles, each providing 7 variants. Values depend on the theme (see build/mu.theme.json).

Variants per role #

For each role (primary, secondary, tertiary, contrast, accent, success, info, warning, error, pop, spark):

DescriptionSuffix
Main color of the role(base)
Colored background (light tint in light mode, dark tint in dark mode)-background
Hover color-hover
Hover background-hover-background
Focus ring color (semi-transparent)-focus
Text on colored background (#fff or #000)-inverse
Semi-transparent underline-underline

Example #

.custom-element {
    color: var(--mu-primary);
    background-color: var(--mu-primary-background);
    border: 1px solid var(--mu-primary);
}

.custom-element:hover {
    color: var(--mu-primary-hover);
    background-color: var(--mu-primary-hover-background);
}

Headings #

DescriptionVariable
<h1> color--mu-h1-color
<h2> color--mu-h2-color
<h3> color--mu-h3-color
<h4> color--mu-h4-color
<h5> color--mu-h5-color
<h6> color--mu-h6-color

Each heading level uses a slightly lighter shade than the previous one.

Components #

Code #

DescriptionVariable
Background of <code>, <pre>, <samp> elements--mu-code-background-color
Code text--mu-code-color
Background of <kbd>--mu-code-kbd-background-color
Text of <kbd>--mu-code-kbd-color

Card #

DescriptionVariable
Card background--mu-card-background-color
Card border--mu-card-border-color
Card shadow--mu-card-box-shadow
Header/footer background--mu-card-sectioning-background-color

Table #

DescriptionVariable
Table border--mu-table-border-color
Striped row background--mu-table-row-stripped-background-color

Accordion #

DescriptionVariable
Accordion border--mu-accordion-border-color
Active title color--mu-accordion-active-summary-color
Closed title color--mu-accordion-close-summary-color
Open title color--mu-accordion-open-summary-color

Dropdown #

DescriptionVariable
Menu background--mu-dropdown-background-color
Menu border--mu-dropdown-border-color
Menu text--mu-dropdown-color
Hover background--mu-dropdown-hover-background-color
Menu shadow--mu-dropdown-box-shadow

Progress #

DescriptionVariable
Bar background--mu-progress-background-color
Progress color--mu-progress-color

Tooltip #

DescriptionVariable
Tooltip background--mu-tooltip-background-color
Tooltip text--mu-tooltip-color

Switch #

DescriptionVariable
Unchecked background--mu-switch-background-color
Checked background--mu-switch-checked-background-color
Thumb color--mu-switch-color

Range #

DescriptionVariable
Track border--mu-range-border-color
Active border--mu-range-active-border-color
Thumb color--mu-range-thumb-color
Active thumb--mu-range-thumb-active-color

Blockquote #

DescriptionVariable
Quote border--mu-blockquote-border-color
Quote footer color--mu-blockquote-footer-color

Modal #

DescriptionVariable
Overlay background--mu-modal-overlay-background-color
Blur filter (blur(0.375rem))--mu-modal-overlay-backdrop-filter

Buttons #

DescriptionVariable
Button shadow--mu-button-box-shadow
Hover shadow--mu-button-hover-box-shadow

Shadows #

DescriptionVariable
Default shadow (used by cards, dropdowns)--mu-box-shadow

Global override #

To customize the framework, override the variables on :root:

:root {
    --mu-font-family: "Inter", sans-serif;
    --mu-border-radius: 0.5rem;
    --mu-spacing: 1.25rem;
    --mu-primary: #e63946;
}

For theme-specific overrides, target the corresponding selectors (see Dark mode).

Accessibility #

  • All color variables are designed to maintain WCAG AA contrast ratios in both light and dark modes.
  • The responsive font sizing ensures readability across screen sizes without requiring user zoom.
  • Focus-related variables (--mu-outline-width, -focus suffixes) ensure visible focus indicators for keyboard navigation.
  • When overriding variables, verify that your custom values maintain sufficient contrast ratios.

See also: Dark mode · Container · Grid