mdui has built-in 19 groups of primary colors and 16 groups of accent colors from Material Design. All colors (including text color and text opacity on backgrounds) are consistent with Official Material Design documentation.
Colors in Material Design are divided into Primary colors and Accent colors, each with several different shades.
In the CSS class names in the following documentation, [color] represents the color name, and [degree] represents the shade.
There are 19 primary colors, including:
Each primary color has 10 shades:
The background color class name is .mdui-color-[color]-[degree]. It sets the background color while also setting the text color and text opacity for that background.
In addition, both primary and accent colors have a default background color class:
.mdui-color-[color] is equivalent to .mdui-color-[color]-500..mdui-color-[color]-accent is equivalent to .mdui-color-[color]-a200.<div class="mdui-color-blue-200">mdui-color-blue-200</div>
<div class="mdui-color-blue">mdui-color-blue</div>
<div class="mdui-color-pink-accent">mdui-color-pink-accent</div>
<div class="mdui-color-pink-a200">mdui-color-pink-a200</div>All available background color class names are listed in the Color Reference Table below.
The text color class name is .mdui-text-color-[color]-[degree].
In addition, both primary and accent colors have a default text color class:
.mdui-text-color-[color] is equivalent to .mdui-text-color-[color]-500..mdui-text-color-[color]-accent is equivalent to .mdui-text-color-[color]-a200.<div class="mdui-text-color-blue-900">mdui-text-color-blue-900</div>
<div class="mdui-text-color-blue">mdui-text-color-blue</div>
<div class="mdui-text-color-blue-a200">mdui-text-color-blue-a200</div>
<div class="mdui-text-color-blue-accent">mdui-text-color-blue-accent</div>Additionally, mdui provides black and white text colors and icon colors with opacity.
.mdui-text-color-black-* is used for light backgrounds..mdui-text-color-white-* is used for dark backgrounds.mdui provides a theme feature, where theme switching can be achieved by adding a few classes to the body, including primary color, accent color, and background color.
Most mdui components have default colors. After setting the theme color, these components will also use the theme color to replace the default color.
Add the class .mdui-theme-primary-[color] to the body to set the primary color.
Use the following classes in the page; these colors will change according to the theme color in the body:
.mdui-color-theme.mdui-color-theme-[degree].mdui-text-color-theme.mdui-text-color-theme-[degree]Add the class .mdui-theme-accent-[color] to the body to set the accent color.
Use the following classes in the page; these colors will change according to the theme color in the body:
.mdui-color-theme-accent.mdui-color-theme-[degree].mdui-text-color-theme-accent.mdui-text-color-theme-[degree]Add the class .mdui-theme-layout-dark to the body to set the entire page (including components) to a dark background.
Add the class .mdui-theme-layout-auto to the body to enable the background color of the entire page (including components) to adjust automatically according to the OS theme.
In addition, use the following classes in the page; these colors will change based on the theme color, showing as dark for light themes and light for dark themes.
.mdui-text-color-theme-text.mdui-text-color-theme-secondary.mdui-text-color-theme-disabled.mdui-text-color-theme-divider.mdui-text-color-theme-icon.mdui-text-color-theme-icon-disabledYou can click the color_lens icon in the upper right corner of the page to set the theme color, and the primary color, accent color, and theme color in the color table below will change accordingly.
| Class Name | Description |
|---|---|
.mdui-theme-primary-[color] | Sets the primary color of the theme (added to the <body> element). |
.mdui-theme-accent-[color] | Sets the accent color of the theme (added to the <body> element). |
.mdui-theme-layout-dark | Sets to dark theme (added to the <body> element). |
| Class Name | Description |
|---|---|
.mdui-color-[color] | Sets the background color of a specific primary color. |
.mdui-color-[color]-accent | Sets the background color of a specific accent color. |
.mdui-color-[color]-[degree] | Sets the background color of a specific color and shade. |
.mdui-color-theme | Sets the background color based on the primary color theme defined in the body. |
.mdui-color-theme-accent | Sets the background color based on the accent color theme defined in the body. |
.mdui-color-theme-[degree] | Sets the background color of a specific shade based on the primary or accent color theme defined in the body. |
.mdui-color-black | Sets a pure black background color. |
.mdui-color-white | Sets a pure white background color. |
.mdui-color-transparent | Sets a transparent background color. |
| Class Name | Description |
|---|---|
.mdui-text-color-[color] | Sets the text color of a specific primary color. |
.mdui-text-color-[color]-accent | Sets the text color of a specific accent color. |
.mdui-text-color-[color]-[degree] | Sets the text color of a specific color and shade. |
.mdui-text-color-theme | Sets the text color based on the primary color theme in the body. |
.mdui-text-color-theme-accent | Sets the text color based on the accent color theme in the body. |
.mdui-text-color-theme-[degree] | Sets the text color of a specific shade based on the primary or accent color theme in the body. |
Dark text colors, used on light backgrounds:
| Class Name | Description |
|---|---|
.mdui-text-color-black | Sets a pure black text color. |
.mdui-text-color-black-text | Sets the text color for primary text. |
.mdui-text-color-black-secondary | Sets the text color for secondary text. |
.mdui-text-color-black-disabled | Sets the text color for disabled state. |
.mdui-text-color-black-divider | Sets the text color for dividers. |
.mdui-text-color-black-icon | Sets the color for icons. |
.mdui-text-color-black-icon-disabled | Sets the icon color for disabled state. |
Light text colors, used on dark backgrounds:
| Class Name | Description |
|---|---|
.mdui-text-color-white | Sets a pure white text color. |
.mdui-text-color-white-text | Sets the text color for primary text. |
.mdui-text-color-white-secondary | Sets the text color for secondary text. |
.mdui-text-color-white-disabled | Sets the text color for disabled state. |
.mdui-text-color-white-divider | Sets the text color for dividers. |
.mdui-text-color-white-icon | Sets the color for icons. |
.mdui-text-color-white-icon-disabled | Sets the icon color for disabled state. |
Dark or light text colors that change based on theme color:
| Class Name | Description |
|---|---|
.mdui-text-color-theme-text | Sets the text color for primary text. Defaults to dark, light under dark theme. |
.mdui-text-color-theme-secondary | Sets the text color for secondary text. Defaults to dark, light under dark theme. |
.mdui-text-color-theme-disabled | Sets the text color for disabled state. Defaults to dark, light under dark theme. |
.mdui-text-color-theme-divider | Sets the text color for dividers. Defaults to dark, light under dark theme. |
.mdui-text-color-theme-icon | Sets the color for icons. Defaults to dark, light under dark theme. |
.mdui-text-color-theme-icon-disabled | Sets the icon color for disabled state. Defaults to dark, light under dark theme. |