@harryho/swatch-color
Version:
The customized package for the color of swatches.
40 lines (39 loc) • 1.15 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.genSwatchColor = void 0;
function genSwatchColor(colorData) {
var swatchColor;
if (isValidColorData(colorData)) {
return swatchColor = __assign({}, colorData);
}
else
return null;
}
exports.genSwatchColor = genSwatchColor;
// The validation here is just dummy one
function isValidColorData(colorData) {
var isValid = true;
switch (colorData.type) {
case "rgb":
// TODO -- Add your validation here
break;
case "hsl":
// TODO -- Add your validation here
break;
case "brgb":
// TODO -- Add your validation here
break;
}
return isValid;
}