import Color from "color";
export const numberToHex = (number) => "#" + number;
export const hexToNumber = (number) => number.substr(1, number.length);
export const errorColor = "transparent";
export const isValidHex = (color) => {
    if (!color || typeof color !== "string")
        return false;
    if (color.substring(0, 1) === "#")
        color = color.substring(1);
    switch (color.length) {
        case 3:
            return /^[0-9A-F]{3}$/i.test(color);
        case 6:
            return /^[0-9A-F]{6}$/i.test(color);
        case 8:
            return /^[0-9A-F]{8}$/i.test(color);
        default:
            return false;
    }
};
export const getColorsList = (colorsAmount, colorsShiftAmount, mixColor, rotate, saturation, mainColor) => Array.from(Array(colorsAmount)).map((_, step) => numberToHex(mainColor)
    ? Color(mainColor)
        .rotate(((step + 1) / colorsAmount) * -rotate)
        .saturate(((step + 1) / colorsAmount) * (saturation / 100))
        .mix(Color(mixColor), ((colorsShiftAmount / 100) * (step + 1)) / colorsAmount)
        .string()
    : errorColor);
//# sourceMappingURL=color.js.map