Getting started
Multiple themes
Learn how to have multiple themes in the same project.
It is possible to have multiple themes in the same project if you use a config file. Below we go through two ways to do it.
This page assumes that you have read "Build your theme".
Same color names
If you have two themes that will be switched between in the same interface, you must use the same color names in both themes. Then you can put both in one config file, which generates two CSS files, one per theme.
For example:
{
"themes": {
"some-org": {
"colors": {
"dominant": "#0062BA",
"first": "#F45F63",
"second": "#E5AA20",
"neutral": "#303030"
}
},
"other-org": {
"colors": {
"dominant": "#ffaaaa",
"first": "#abcdef",
"second": "#123456",
"neutral": "#c05030"
}
}
}
}
You can validate the config file in the Theme Builder. Click Import config and paste the config file.
Different color names
If the themes have different color names, they can't be in the same config file. The CLI doesn't accept it, and Figma can't switch between them with modes, because of limitations in how Figma handles modes. In this case, you need to create one config file for each theme, and run the command once for each config file.
It is common to have to do it this way if you have a repository that collects all the themes for multiple brands.
some-org.config.json:
{
"output": [{ "type": "css", "dir": "./some-org-css" }],
"themes": {
"some-org": {
"colors": {
"dominant": "#0062BA",
"first": "#F45F63",
"second": "#E5AA20",
"neutral": "#303030"
}
}
}
}
other-org.config.json:
{
"output": [{ "type": "css", "dir": "./other-org-css" }],
"themes": {
"other-org": {
"colors": {
"accent": "#0062BA",
"brand1": "#F45F63",
"brand2": "#E5AA20",
"neutral": "#303030"
}
}
}
}
Run them one after the other:
npx @digdir/designsystemet@latest --config some-org.config.json &&
npx @digdir/designsystemet@latest --config other-org.config.json
Note that we have different output folders in the two config files, so that the CSS for each theme is placed in its own folder.