UNPKG

@tokens-studio/sd-transforms

Version:

Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio

9 lines (8 loc) 360 B
import Color from 'colorjs.io'; import { defaultColorPrecision } from '../utils/constants.js'; export function mix(color, colorSpace, amount, mixColor) { const mixValue = Math.max(0, Math.min(1, Number(amount))); return new Color(color .mix(mixColor, mixValue, { space: colorSpace }) .toString({ precision: defaultColorPrecision })); }