1.0.0 • Published 3 years ago

@skyscanner/bpk-react-native v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

@skyscanner/bpk-react-native

React Native design tokens for colours, spacing, font, etc.

Installation

npm install @skyscanner/bpk-react-native --save-dev

Usage

JavaScript (ES6 module):

For React Native:

// Individual tokens
import { spacingBase } from '@skyscanner/bpk-react-native/tokens/base.react.native';

console.log(spacingBase);

// Whole token categories
import { colors } from '@skyscanner/bpk-react-native/tokens/base.react.native';

console.log(colors.colorSkyGrayTint01);

// All tokens
import * as tokens from '@skyscanner/bpk-react-native/tokens/base.react.native';

console.log(tokens);

For web:

// Individual tokens
import { spacingBase } from '@skyscanner/bpk-react-native/tokens/base.es6';

console.log(spacingBase);

// Whole token categories
import { colors } from '@skyscanner/bpk-react-native/tokens/base.es6';

console.log(colors.colorSkyGrayTint01);

// All tokens
import * as tokens from '@skyscanner/bpk-react-native/tokens/base.es6';

console.log(tokens);

JavaScript (CommonJS):

// Individual tokens
import { spacingBase } from '@skyscanner/bpk-react-native/tokens/base.common';

console.log(spacingBase);

// All tokens
import * as tokens from '@skyscanner/bpk-react-native/tokens/base.common';

console.log(tokens);

Transparency

It is possible to add opacity to Backpack color tokens as follows:

import { colorSkyBlue } from '@skyscanner/bpk-react-native/tokens/base.react.native';
import { setOpacity } from '@skyscanner/bpk-react-native';

const transparentBlue500 = setOpacity(colorSkyBlue, 0.7);

console.log(transparentBlue500);