UNPKG

@kcuf/mere-color

Version:

Mere color utils for generating, manipulation, a11y purposes.

21 lines (20 loc) 573 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = toString; var _util = require("../util"); var _parse = require("../parse"); /** * Convert or normalize color input to wanted format. */ function toString(input, format) { if (typeof input === 'string') { var rgb = (0, _parse.parseToRgb)(input); if (rgb) { return (0, _util.toColorString)(rgb, format !== null && format !== void 0 ? format : (0, _util.getColorNotation)(input)); } return input; } return (0, _util.toColorString)(input, format); }