bpk-tokens-css
v36.2.3
Published
Backpack design tokens for colors, spacing, font, etc.
Downloads
10
Keywords
Readme
bpk-tokens
Design tokens for colours, spacing, font, etc.
Installation
npm install bpk-tokens --save-dev
Usage
Sass:
@import '~bpk-tokens/tokens/base.default.scss';
.my-selector {
padding: $bpk-spacing-base;
}
JavaScript (ES6 module):
For React Native:
// Individual tokens
import { spacingBase } from 'bpk-tokens/tokens/base.react.native';
console.log(spacingBase);
// Whole token categories
import { colors } from 'bpk-tokens/tokens/base.react.native';
console.log(colors.colorSkyGrayTint01);
// All tokens
import * as tokens from 'bpk-tokens/tokens/base.react.native';
console.log(tokens);
For web:
// Individual tokens
import { spacingBase } from 'bpk-tokens/tokens/base.es6';
console.log(spacingBase);
// Whole token categories
import { colors } from 'bpk-tokens/tokens/base.es6';
console.log(colors.colorSkyGrayTint01);
// All tokens
import * as tokens from 'bpk-tokens/tokens/base.es6';
console.log(tokens);
JavaScript (CommonJS):
// Individual tokens
import { spacingBase } from 'bpk-tokens/tokens/base.common';
console.log(spacingBase);
// All tokens
import * as tokens from 'bpk-tokens/tokens/base.common';
console.log(tokens);
Transparency
It is possible to add opacity to Backpack color tokens as follows:
import { colorSkyBlue } from 'bpk-tokens/tokens/base.react.native';
import { setOpacity } from 'bpk-tokens';
const transparentBlue500 = setOpacity(colorSkyBlue, 0.7);
console.log(transparentBlue500);