style-dictionary-utils
Version:
Utilities to use in your style dictionary config
15 lines (14 loc) • 391 B
JavaScript
import { toRgba } from 'color2k';
import { isColor } from '../filter/isColor.js';
import { getValue } from '../utilities/getValue.js';
/**
* colorToRgba
* @description convert a token of type `color` to a rgba value
*/
export const colorToRgba = {
name: 'color/rgba',
type: `value`,
transitive: true,
filter: isColor,
transform: (token) => toRgba(getValue(token)),
};