"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toHexFormat = exports.getRoundNumber = exports.getHex = exports.getAlphaColor = exports.generateColor = exports.customizePrefixCls = void 0;
var _color = require("./color");
var customizePrefixCls = 'ant-color-picker';
exports.customizePrefixCls = customizePrefixCls;
var generateColor = function generateColor(color) {
  if (color instanceof _color.ColorFactory) {
    return color;
  }
  return new _color.ColorFactory(color);
};
exports.generateColor = generateColor;
var getRoundNumber = function getRoundNumber(value) {
  return Math.round(Number(value || 0));
};
exports.getRoundNumber = getRoundNumber;
var getAlphaColor = function getAlphaColor(color) {
  return getRoundNumber(color.toHsb().a * 100);
};
exports.getAlphaColor = getAlphaColor;
var toHexFormat = function toHexFormat(value, alpha) {
  return (value === null || value === void 0 ? void 0 : value.replace(/[^\w/]/gi, '').slice(0, alpha ? 8 : 6)) || '';
};
exports.toHexFormat = toHexFormat;
var getHex = function getHex(value, alpha) {
  return value ? toHexFormat(value, alpha) : '';
};
exports.getHex = getHex;