Skip to content

Color

The color component will help you to easily define your custom theme colors.

Options

Use the global $color parameter to configure color schemes.

OptionTypeDescriptionDefault
prefixstringUpdate color prefix name on any custom properties.color
tokensmapAdd map of color tokens. Needed for tokens validation when theme() mixin is used.()

Example

scss
@use "@magnesium/theme" with (
    $color: (
        "tokens": (
            "primary",
            "secondary"
        )
    )
);

Theme

Override the theme custom property with the theme() mixin.

Usage

scss
@use "@magnesium/theme/color";

:root {
    @include color.theme((
        "primary": darkcyan,
        "secondary": darkorange
    ));
}

Returns

scss
:root {
    --mg-color-primary: darkcyan;
    --mg-color-secondary: darkorange;
}

Released under the MIT License.