UNPKG

@onesy/utils

Version:
19 lines (18 loc) 899 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const isValid_1 = __importDefault(require("./isValid")); const rgbToRgba_1 = __importDefault(require("./rgbToRgba")); const hexToRgb_1 = __importDefault(require("./hexToRgb")); const hslToRgb_1 = __importDefault(require("./hslToRgb")); const colorToRgb = (value, opacity = undefined, array = false) => { if ((0, isValid_1.default)('color-rgb', value)) return (0, rgbToRgba_1.default)(value, opacity, array); if ((0, isValid_1.default)('color-hex', value)) return (0, hexToRgb_1.default)(value, opacity, array); if ((0, isValid_1.default)('color-hsl', value)) return (0, hslToRgb_1.default)(value, opacity, array); }; exports.default = colorToRgb;