ComponentsTheming and globalization
Theme
MudThemeProvider turns a MudTheme into CSS variables that every component reads: palette, typography, shape and shadows. Change the theme once instead of styling components one by one.
The palette, as CSS variables
Each palette color becomes a --mud-palette-* variable on the page. These swatches read the variables directly, so the dark-mode switch in the app bar changes them all at once.
Brand
Primary
--mud-palette-primarySecondary
--mud-palette-secondaryTertiary
--mud-palette-tertiaryStatus
Info
--mud-palette-infoSuccess
--mud-palette-successWarning
--mud-palette-warningError
--mud-palette-errorDark
--mud-palette-darkSurfaces
Background
--mud-palette-backgroundSurface
--mud-palette-surfaceAppbar background
--mud-palette-appbar-backgroundDrawer background
--mud-palette-drawer-backgroundText and lines
Text primary
--mud-palette-text-primaryText secondary
--mud-palette-text-secondaryAction default
--mud-palette-action-defaultLines default
--mud-palette-lines-defaultLines inputs
--mud-palette-lines-inputsDivider
--mud-palette-dividerTheme builder
Pick colors and a corner radius, check the contrast, and copy the MudTheme. The preview overrides the same variables on its own container, so the rest of this page keeps the site's theme.
Night tours
Book a guided evening at the observatory.
private readonly MudTheme _theme = new()
{
PaletteLight = new PaletteLight
{
Primary = "#b4441f",
Secondary = "#1f5f5b"
},
LayoutProperties = new LayoutProperties { DefaultBorderRadius = "6px" }
};
<MudThemeProvider Theme="_theme" />Your own CSS, theme-aware
Use the palette variables in your own styles and they follow the theme, including dark mode, with no extra code.
1.4″
82%
31 km/h
21.3