UNPKG

svg-color-linter

Version:

Linting tool to check if SVG files use only colors of a given color palette

12 lines (11 loc) 471 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateColor = void 0; const utils_1 = require("./utils"); const validateColor = (color, palette) => { if (!(0, utils_1.isValidColor)(color)) { throw new Error(`The given color "${color}" is not valid!`); } return palette.some((paletteColor) => paletteColor.toUpperCase() === (0, utils_1.toHexColor)(color).toUpperCase()); }; exports.validateColor = validateColor;