"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.validateConfigColor = exports.hexToRgba = exports.getSkeletonBackgrounColor = void 0;
var _polished = require("polished");
const hexColorRegExp = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
const validateConfigColor = color => {
  if (!color || !hexColorRegExp.test(color)) return '#00000000';
  return color;
};
exports.validateConfigColor = validateConfigColor;
const hexToRgba = (hex, alpha) => {
  const hexColor = hex.replace('#', '');
  const r = parseInt(hexColor.substring(0, 2), 16);
  const g = parseInt(hexColor.substring(2, 4), 16);
  const b = parseInt(hexColor.substring(4, 6), 16);
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
};
exports.hexToRgba = hexToRgba;
const getSkeletonBackgrounColor = themeColor => {
  const backgroundColor = (0, _polished.lighten)(0.2, themeColor.colors.baseShade3);
  const foregroundColor = themeColor.colors.baseShade4;
  return {
    backgroundColor,
    foregroundColor
  };
};
exports.getSkeletonBackgrounColor = getSkeletonBackgrounColor;
//# sourceMappingURL=color.js.map