How to use
We use tokens instead of static values (like HEX codes) for color or sizing units.
Installationβ
You donβt need to install the tokens because theyβre included as a dependency to ensure compatibility.
You can install the package on its own.
npm install --save @danielwang/aemo-design-tokens
How to useβ
To use the default tokens, add an import in the file where you want to use the design tokens.
Supported formatβ
Tokens are generated by JSON files from Figma, which enables us to transform this type of file into different ones. It should be possible to transform JSON into SASS, LESS, Stylus, XML, and others.
CSS Variablesβ
@import url('aemo-tokens.css');
.class_name {
color: var(--gel-color-primary-purple-500);
}
Sassβ
@import "aemo-tokens.scss";
.class_name {
color: $gel-color-primary-purple-500;
}
Lessβ
@import (reference) "aemo-tokens.less";
.class_name {
color: @gel-color-primary-purple-500;
}
JavaScriptβ
import token from 'aemo-tokens.js';
document.getElementById(id).style.color = token.ColorPrimaryPurple500;
XMLβ
Download and paste aemo-tokens.android.xml to your Android project. Then:
<item android:color="@color/gel_color_primary_purple_500" />
Swiftβ
Download and paste aemo-tokens.android.swift to your Swift project. Then:
tokens.gelColorPrimaryPurple500