"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.findColor = findColor;
exports.isColorEqual = isColorEqual;

var _color = _interopRequireDefault(require("color"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function findColor(color, colorEnum) {
  for (var key in colorEnum) {
    if (isColorEqual(colorEnum[key], color)) {
      return key;
    }
  }

  return null;
}

function isColorEqual(a, b) {
  return new _color["default"](a).contrast(new _color["default"](b)) === 1;
}