Color
All of the theme's colors come from m3e's dynamic color. You only need one seed color: m3e-theme generates the full set of --md-sys-color-* tokens from it. When you switch light and dark mode, contrast or variant, the whole palette updates together.
Dynamic color
The seed color sets the relationship between hue and tone, and Material 3's tone mapping computes the actual lightness. So the same seed gives readable colors in both light and dark mode. The demo below generates a local palette from a teal seed:
--md-sys-color-primary--md-sys-color-primary-container--md-sys-color-secondary-container--md-sys-color-tertiaryThe site's default seed color is set in settings.defaults.color in the shared config. Readers can change it to a color they like in the settings. Pages with a hero use a color taken from the image; see Hero.
Variants
The same seed color can generate a palette in different ways. The default is tonal-spot:
| Variant | Character |
|---|---|
tonal-spot | Balanced and low in saturation; suits most documentation sites |
vibrant | A more saturated primary color, with a stronger brand feel |
fidelity | Stays closer to the seed color itself |
expressive | Livelier hue shifts |
monochrome | Drops any color cast and keeps only levels of lightness |
neutral | Near-neutral surface colors |
rainbow | Larger hue differences between roles |
fruit-salad | The strongest hue separation; suits demos and creative uses |
Light, dark and contrast
The same palette, mapped to light and dark:
Light surfaces with dark text. Suits daytime use and projection.
Dark surfaces with light text. Suits low light and long reading sessions.
Contrast has three levels: Default, Medium and High. It affects the lightness difference between foreground and background, and the strength of outlines. Light and dark modes have four options; see Settings and appearance.
Usage guidelines
- Don't hard-code colors. Always use
--md-sys-color-*tokens or the variables of m3e components. - Use container and content colors in pairs:
primarywithon-primary,surface-containerwithon-surface. - Use
surface-container-lowestthroughsurface-container-highestto separate levels. Don't rely on stacked shadows. - Use
outline-variantfor borders and dividers, andoutlinewhen they need emphasis. Useerroranderror-containerfor error states. - When you need a fixed brand color, make it the seed color instead of overriding it component by component.
- Check custom backgrounds, shadows and translucent scrims separately in dark mode and high contrast.
For all color tokens, see API.