Theme and variables for AI2's Varnish
npm install @allenai/varnish-themevarnish-theme contains design tokens and basic CSS for AI2's varnish component library.
First, install varnish-theme:
``bash`
yarn add @allenai/varnish-theme
.If you have the webpack css-loader set up, you can import them this way:
For the tokens:
`css
@import '~@allenai/varnish-theme/dist/varnish-tokens.css' layer(varnish);
`For the main CSS:
`css
@import '~@allenai/varnish-theme/varnish.css' layer(varnish);
`$3
We provide a typed JS file you can import.
`js
import varnishTokens from '@allenai/varnish-theme'
`$3
We provide a JSON file similar to the JS file.To import it in JS:
`js
import varnishTokens from '@allenai/varnish-theme/varnish-tokens.json'
`$3
If you want the theme with just the values, hexAlpha colors, and spacing tokens provided in pixels without a number, we provide that as well.
`js
import simpleVarnishTokens from '@allenai/varnish-theme/simple-hex-unitless'
`Development
We use (style-dictionary)[https://amzn.github.io/style-dictionary/#/] and (style-dictionary-utils)[https://github.com/lukasoppermann/style-dictionary-utils] to create the exported files.To add or change tokens, modify .js files in the
tokens folder. To update the output with your new tokens, run yarn workspace @allenai/varnish-theme build.Adding Icons
First, add your svg file under icons folder. Then update tokens/assets/icon.cjs with this filepath. Then run yarn workspace @allenai/varnish-theme buildUpdating Figma with varnish-theme tokens
Further instructions here
1. Go to your Figma document
2. Click the Figma button in the top left corner. Go to plugins, and install Tokens Studio for Figma and open it
3. Here you will see a visual representation of your tokens including colors, spacing, etc. Go to the tokens you want to edit and click the {}` button in the top right.