UNPKG

vira

Version:

A simple and highly versatile design system using element-vir.

33 lines (32 loc) 698 B
import { stringify } from '@augment-vir/common'; import { Color } from '../re-exports/colorjs-io.js'; /** * Asserts that the given color type is valid. * * @category Internal */ export function getAssertedValidColor(input) { try { if (!input) { throw new Error('invalid empty color'); } return new Color(input); } catch { throw new Error(`Invalid color: ${stringify(input)}`); } } /** * The colorjs format for CSS RGB colors. * * @category Internal */ export const rgbCssColorFormat = { name: 'rgb', coords: [ '<number>[0, 255]', '<number>[0, 255]', '<number>[0, 255]', ], commas: true, };