import { keysOf } from '../../components/common.js';
import { hexToRgb } from '../../helpers/hex-to-rgb.js';
import { isColorDark } from '../../helpers/is-color-dark.js';
import '../../helpers/is-valid-hex.js';
import 'chroma-js';
import { euiPaletteColorBlindBehindText } from '../color/eui_palettes.js';

const VIS_COLORS = euiPaletteColorBlindBehindText();
const colorToHexMap = {
  default: '#d3dae6',
  primary: VIS_COLORS[1],
  success: VIS_COLORS[0],
  accent: VIS_COLORS[2],
  warning: VIS_COLORS[5],
  danger: VIS_COLORS[9]
};
const COLORS = keysOf(colorToHexMap);
const baseClass = 'euiBadge';
function inlineStyles({
  badgeColor
}) {
  let textColor = null;
  let colorHex = 'default';
  if (COLORS.indexOf(badgeColor) > -1) {
    colorHex = colorToHexMap[badgeColor];
    textColor = isColorDark(...hexToRgb(colorHex)) ? '#fff' : '#000';
  } else if (badgeColor !== 'hollow') {
    textColor = isColorDark(...hexToRgb(badgeColor)) ? '#fff' : '#000';
    colorHex = badgeColor;
  }
  return {
    'background-color': colorHex,
    color: textColor
  };
}
const iconSideMapping = {
  left: `${baseClass}--iconLeft`,
  right: `${baseClass}--iconRight`
};
const colorMapping = {
  hollow: `${baseClass}--hollow`,
  primary: '',
  success: '',
  accent: '',
  warning: '',
  danger: ''
};
const mapping = {
  base: baseClass,
  properties: {
    iconSide: iconSideMapping,
    color: colorMapping
  },
  inlineStyles: inlineStyles
};

export { COLORS, VIS_COLORS, baseClass, colorMapping, colorToHexMap, mapping as default, iconSideMapping, inlineStyles };
//# sourceMappingURL=eui-badge.js.map
