UNPKG

@kcuf/mere-color

Version:

Mere color utils for generating, manipulation, a11y purposes.

21 lines (20 loc) 458 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = parseToRgb; var _util = require("../util"); /** * Parse valid color string into an `ColorRgb` object. * * Valid inputs are: * * - named colors * - hex3/4/6/8 * - rgb(a) - modern/legacy * - hsl(a) - modern/legacy */ function parseToRgb(color) { var rgb = (0, _util.parseToRgbUnnormalized)(color); return rgb ? (0, _util.rgbNormalize)(rgb) : null; }