1
Export the theme
Pick a source colour, or one each for primary, secondary and tertiary, and export the theme as JSON. The file,
material-theme.json, keeps its schemes under schemes, and the light and dark ones each name 49 roles in camel case.2
Convert it to overrides
Every one of those roles is a role here under the same name,
onPrimaryContainer being --kui-color-on-primary-container, so this script turns the two schemes into overrides:theme.mjs
3
Load the stylesheet
Load
theme.css like any other stylesheet of yours.schemes also holds a medium-contrast and a high-contrast version of each scheme, light-medium-contrast and the rest. Read those in place of light and dark for an app that offers more contrast.
An app that pins light or dark keys the two blocks on its own switch rather than on the media query. See Light or dark.
Positive and negative
positive and negative are the two roles here that Material Design does not have. They are the positive and negative tones on Avatar, Currency, Meter, ProductIcon, Tag and Text, and the pair Currency’s auto tone picks between by a value’s sign. They are kept apart from error, so a negative amount does not read as a failed field.
The export has no role for them, so they keep the library’s own green and rust unless you set them. To match them to a brand, add each as a custom colour in Theme Builder. A custom colour is drawn at the tones Material Design draws error at, which is how the library’s own two are drawn, and its four roles in each scheme map onto four here:
negative takes its four the same way. With the 49 from the script, that is every colour role tokens.css lists.
