UNPKG

@vimeo/iris

Version:
27 lines (22 loc) 845 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tokens_util_readToken = require('../../util/readToken.js'); var color_colors = require('../../../color/colors.js'); var tokens_util_clamp = require('../../util/clamp.js'); require('polished'); var surface = function (grade) { return tokens_util_readToken.readToken(token, grade); }; var token = { default: 'light', type: 'COLOR', modes: { dark: dark, light: light }, }; function dark(grade) { return color_colors.grayscale(tokens_util_clamp.clamp(-1 * (grade / 5 - 1000))); } function light(grade) { return grade >= 300 ? color_colors.white : color_colors.slate(tokens_util_clamp.clamp(-1 * (grade / 2 - 150))); } surface.primary = surface(400); surface.secondary = surface(600); surface.tertiary = surface(800); exports.surface = surface;