
Theming with CSS
How to restyle the widget with CSS custom properties, and details of the default accessible palette.
Every colour and measurement resolves through a CSS custom property on .simplemathcaptcha, so a template can restyle the widget without fighting selector specificity:
.simplemathcaptcha {
--smc-accent: #7c3aed;
--smc-radius: 999px;
--smc-equation-size: 1.4rem;
}
The full set: --smc-accent, --smc-border, --smc-muted, --smc-surface, --smc-danger, --smc-success, --smc-timer-track, --smc-timer-fill, --smc-timer-warn, --smc-timer-size, --smc-timer-stroke, --smc-bar-thickness, --smc-equation-size, --smc-equation-weight, --smc-radius, --smc-gap, --smc-input-width, --smc-progress.
Default palette: out of the box, with no admin colour overrides, the widget ships an accessibility-verified palette rather than an arbitrary one — accent #1d4ed8, danger #dc2626, success #15803d — each checked to clear 4.5:1 text contrast against both a white and a dark page background. The accent follows prefers-color-scheme for its light/dark pairing, appropriate for a non-text element (focus ring, timer) which only needs 3:1. The danger and success colours, which render as actual status text, deliberately do not follow prefers-color-scheme — that media query reflects the visitor's OS setting, not the page's actual background, and a light template viewed with a dark OS theme would otherwise show pale "dark mode" text at unacceptably low contrast. They're instead derived with color-mix(in srgb, currentColor 20%, <base> 80%), which blends toward whatever the surrounding template actually resolved for body text — correct on a light or dark template alike, without needing to guess which one it is.