@kdcloudjs/kdesign 1.7.51 → 1.7.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kdesign.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/kdesign v1.7.50
3
+ * @kdcloudjs/kdesign v1.7.52
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -9527,8 +9527,8 @@ __webpack_require__.r(__webpack_exports__);
9527
9527
  /* harmony import */ var _constant_defaultColor__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./constant/defaultColor */ "./components/color-picker/constant/defaultColor.ts");
9528
9528
  /* harmony import */ var _utils_validateColor__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./utils/validateColor */ "./components/color-picker/utils/validateColor.ts");
9529
9529
  /* harmony import */ var _utils_convertLetters__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/convertLetters */ "./components/color-picker/utils/convertLetters.ts");
9530
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! color-ie */ "./node_modules/color-ie/lib/index.js");
9531
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(color_ie__WEBPACK_IMPORTED_MODULE_16__);
9530
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! color */ "./node_modules/color/index.js");
9531
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(color__WEBPACK_IMPORTED_MODULE_16__);
9532
9532
  /* harmony import */ var react_color__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! react-color */ "./node_modules/react-color/es/index.js");
9533
9533
  /* harmony import */ var _utils_devwarning__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../_utils/devwarning */ "./components/_utils/devwarning.ts");
9534
9534
  /* harmony import */ var _utils_hooks__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../_utils/hooks */ "./components/_utils/hooks.tsx");
@@ -9678,7 +9678,7 @@ var ColorPickerPanel = function ColorPickerPanel(props) {
9678
9678
  setIsFollow(switchValue);
9679
9679
  if (switchValue) {
9680
9680
  formatArr = Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["colorFormat"])(functionalColor, alpha);
9681
- setPanelState(formatArr, formatArr[Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["valOfCorrespondingType"])(currentColorType)].value, functionalColorName, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["strFixed"])(color_ie__WEBPACK_IMPORTED_MODULE_16___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["getColorObj"])(functionalColor)).alpha(), 2), Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["strFixed"])(color_ie__WEBPACK_IMPORTED_MODULE_16___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["getColorObj"])(functionalColor)).alpha(), 2) * 100 + '%');
9681
+ setPanelState(formatArr, formatArr[Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["valOfCorrespondingType"])(currentColorType)].value, functionalColorName, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["strFixed"])(color__WEBPACK_IMPORTED_MODULE_16___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["getColorObj"])(functionalColor)).alpha(), 2), Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["strFixed"])(color__WEBPACK_IMPORTED_MODULE_16___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["getColorObj"])(functionalColor)).alpha(), 2) * 100 + '%');
9682
9682
  setClickedColorIndex(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["highlightPresetColorIndex"])(formatArr[0].value, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["presetColorToHEX"])(presetColor || _constant_systemPresetColor__WEBPACK_IMPORTED_MODULE_11__["systemPresetColor"])));
9683
9683
  } else {
9684
9684
  formatArr = Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_12__["colorFormat"])(_constant_defaultColor__WEBPACK_IMPORTED_MODULE_13__["defaultSystemColor"], 1, 'all', true);
@@ -9826,8 +9826,8 @@ __webpack_require__.r(__webpack_exports__);
9826
9826
  /* harmony import */ var _utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./utils/colorFormat */ "./components/color-picker/utils/colorFormat.ts");
9827
9827
  /* harmony import */ var _utils_convertLetters__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./utils/convertLetters */ "./components/color-picker/utils/convertLetters.ts");
9828
9828
  /* harmony import */ var _constant_defaultColor__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./constant/defaultColor */ "./components/color-picker/constant/defaultColor.ts");
9829
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! color-ie */ "./node_modules/color-ie/lib/index.js");
9830
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(color_ie__WEBPACK_IMPORTED_MODULE_20__);
9829
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! color */ "./node_modules/color/index.js");
9830
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(color__WEBPACK_IMPORTED_MODULE_20__);
9831
9831
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../_utils */ "./components/_utils/index.ts");
9832
9832
  /* harmony import */ var _utils_usePopper__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../_utils/usePopper */ "./components/_utils/usePopper.tsx");
9833
9833
  /* harmony import */ var _constant_systemPresetColor__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./constant/systemPresetColor */ "./components/color-picker/constant/systemPresetColor.ts");
@@ -9935,8 +9935,8 @@ var ColorPicker = function ColorPicker(props) {
9935
9935
  setAlphaNoVerifyVal(alphaStr);
9936
9936
  };
9937
9937
  if (inputValType) {
9938
- var formatArr = Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["colorFormat"])(inpValue, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["strFixed"])(color_ie__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), 2));
9939
- setState(formatArr, formatArr[Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["valOfCorrespondingType"])(currentColorType)].value, color_ie__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), (Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["strFixed"])(color_ie__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), 2) * 100).toFixed() + '%');
9938
+ var formatArr = Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["colorFormat"])(inpValue, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["strFixed"])(color__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), 2));
9939
+ setState(formatArr, formatArr[Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["valOfCorrespondingType"])(currentColorType)].value, color__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), (Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["strFixed"])(color__WEBPACK_IMPORTED_MODULE_20___default()(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["getColorObj"])(inpValue)).alpha(), 2) * 100).toFixed() + '%');
9940
9940
  setClickedColorIndex(Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["highlightPresetColorIndex"])(formatArr[0].value, Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["presetColorToHEX"])(presetColor || _constant_systemPresetColor__WEBPACK_IMPORTED_MODULE_23__["systemPresetColor"])));
9941
9941
  } else {
9942
9942
  var _formatArr = Object(_utils_colorFormat__WEBPACK_IMPORTED_MODULE_17__["colorFormat"])(_constant_defaultColor__WEBPACK_IMPORTED_MODULE_19__["defaultSystemColor"]);
@@ -10186,8 +10186,8 @@ __webpack_require__.r(__webpack_exports__);
10186
10186
  /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_4__);
10187
10187
  /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js");
10188
10188
  /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_5__);
10189
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! color-ie */ "./node_modules/color-ie/lib/index.js");
10190
- /* harmony import */ var color_ie__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(color_ie__WEBPACK_IMPORTED_MODULE_6__);
10189
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! color */ "./node_modules/color/index.js");
10190
+ /* harmony import */ var color__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(color__WEBPACK_IMPORTED_MODULE_6__);
10191
10191
  /* harmony import */ var _validateColor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./validateColor */ "./components/color-picker/utils/validateColor.ts");
10192
10192
  /* harmony import */ var _convertLetters__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./convertLetters */ "./components/color-picker/utils/convertLetters.ts");
10193
10193
 
@@ -10203,7 +10203,7 @@ var colorFormat = function colorFormat(colorStr) {
10203
10203
  var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
10204
10204
  var outType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
10205
10205
  var formatHex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
10206
- var ColorTools = color_ie__WEBPACK_IMPORTED_MODULE_6___default()(getColorObj(colorStr)).alpha(alpha);
10206
+ var ColorTools = color__WEBPACK_IMPORTED_MODULE_6___default()(getColorObj(colorStr)).alpha(alpha);
10207
10207
  var toHex = function toHex() {
10208
10208
  if (/^#([0-9a-fA-F]{8})$/.test(colorStr)) {
10209
10209
  if (formatHex) {
@@ -17953,10 +17953,10 @@ __webpack_require__.r(__webpack_exports__);
17953
17953
  /* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0__);
17954
17954
  /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
17955
17955
  /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1__);
17956
- /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js");
17957
- /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2__);
17958
- /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js");
17959
- /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_3__);
17956
+ /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js");
17957
+ /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_2__);
17958
+ /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js");
17959
+ /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3__);
17960
17960
  /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.function.name.js */ "./node_modules/core-js/modules/es.function.name.js");
17961
17961
  /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_4__);
17962
17962
  /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
@@ -18029,7 +18029,7 @@ var Filter = function Filter(props) {
18029
18029
 
18030
18030
  // className前缀
18031
18031
  var prefixCls = getPrefixCls(pkgPrefixCls, 'filter', customPrefixcls);
18032
- var _React$useRef = react__WEBPACK_IMPORTED_MODULE_11__["useRef"](props.value || props.defaultValue || {}),
18032
+ var _React$useRef = react__WEBPACK_IMPORTED_MODULE_11__["useRef"](typeof props.value === 'undefined' ? props.defaultValue || {} : props.value || {}),
18033
18033
  defaultValue = _React$useRef.current;
18034
18034
  var _React$useState = react__WEBPACK_IMPORTED_MODULE_11__["useState"](defaultValue),
18035
18035
  _React$useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_React$useState, 2),
@@ -18042,7 +18042,6 @@ var Filter = function Filter(props) {
18042
18042
  _React$useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_React$useState3, 2),
18043
18043
  tab = _React$useState4[0],
18044
18044
  setTab = _React$useState4[1];
18045
- var conditionValue = Object.keys(value).length < 1 || Object.keys(value).length === 1 && value.scheme ? defaultValue : value;
18046
18045
  var onConditionChange = function onConditionChange(nextValue, condition, option) {
18047
18046
  props.value === undefined && setValue(nextValue);
18048
18047
  onChange && onChange(nextValue, condition, option);
@@ -18050,7 +18049,7 @@ var Filter = function Filter(props) {
18050
18049
  var onConditionRemove = function onConditionRemove(key, e) {
18051
18050
  e.preventDefault();
18052
18051
  if (key) {
18053
- var nextValue = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, conditionValue);
18052
+ var nextValue = _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_0___default()({}, value);
18054
18053
  delete nextValue[key];
18055
18054
  onConditionChange(nextValue);
18056
18055
  }
@@ -18165,7 +18164,7 @@ var Filter = function Filter(props) {
18165
18164
  FilterLangMsg: FilterLangMsg,
18166
18165
  onConditionChange: onConditionChange,
18167
18166
  onConditionRemove: onConditionRemove,
18168
- value: conditionValue
18167
+ value: value
18169
18168
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_11__["createElement"](_scheme__WEBPACK_IMPORTED_MODULE_19__["default"], {
18170
18169
  tab: tab,
18171
18170
  fields: fields,
@@ -22502,8 +22501,7 @@ var InternalTextarea = function InternalTextarea(props, ref) {
22502
22501
  }, [autoSize, textareaRef, style]);
22503
22502
  Object(_utils_hooks__WEBPACK_IMPORTED_MODULE_14__["useResizeObserver"])(textareaRef.current, resizeTextarea);
22504
22503
  var handleChange = function handleChange(e) {
22505
- if (value === undefined) return;
22506
- setValue(e.target.value);
22504
+ propsValue === undefined && setValue(e.target.value);
22507
22505
  onChange && onChange(e);
22508
22506
  };
22509
22507
  var handleFocus = function handleFocus(e) {
@@ -22548,11 +22546,6 @@ var InternalTextarea = function InternalTextarea(props, ref) {
22548
22546
  setNumberMarkError(false);
22549
22547
  }
22550
22548
  }, [value]);
22551
- Object(react__WEBPACK_IMPORTED_MODULE_7__["useEffect"])(function () {
22552
- if (propsValue !== undefined) {
22553
- setValue(propsValue);
22554
- }
22555
- }, [propsValue, setValue]);
22556
22549
  Object(react__WEBPACK_IMPORTED_MODULE_7__["useEffect"])(function () {
22557
22550
  if (focused && !showNumberMark) {
22558
22551
  setShowNumberMark(true);
@@ -39306,7 +39299,7 @@ var getInitExpandedKeys = function getInitExpandedKeys(data, expandedKeys, defau
39306
39299
  if (isSearching && searchStatus === 'SEARCH_START') {
39307
39300
  keys = _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default()(getAllFilterKeys(data, filterTreeNode, keysData, expandOnFilterNode).filterExpandKeys);
39308
39301
  }
39309
- return keys;
39302
+ return Array.from(new Set(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1___default()(keys)));
39310
39303
  };
39311
39304
  var getExpandedKeys = function getExpandedKeys(expandedKeys) {
39312
39305
  var expandScrollkeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -61704,2039 +61697,1747 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
61704
61697
 
61705
61698
  /***/ }),
61706
61699
 
61707
- /***/ "./node_modules/color-convert/conversions.js":
61708
- /*!***************************************************!*\
61709
- !*** ./node_modules/color-convert/conversions.js ***!
61710
- \***************************************************/
61700
+ /***/ "./node_modules/color-name/index.js":
61701
+ /*!******************************************!*\
61702
+ !*** ./node_modules/color-name/index.js ***!
61703
+ \******************************************/
61711
61704
  /*! no static exports found */
61712
61705
  /***/ (function(module, exports, __webpack_require__) {
61713
61706
 
61714
- /* MIT license */
61715
- var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-convert/node_modules/color-name/index.js");
61707
+ "use strict";
61716
61708
 
61717
- // NOTE: conversions should only return primitive values (i.e. arrays, or
61718
- // values that give correct `typeof` results).
61719
- // do not use box values types (i.e. Number(), String(), etc.)
61720
61709
 
61721
- var reverseKeywords = {};
61722
- for (var key in cssKeywords) {
61723
- if (cssKeywords.hasOwnProperty(key)) {
61724
- reverseKeywords[cssKeywords[key]] = key;
61710
+ module.exports = {
61711
+ "aliceblue": [240, 248, 255],
61712
+ "antiquewhite": [250, 235, 215],
61713
+ "aqua": [0, 255, 255],
61714
+ "aquamarine": [127, 255, 212],
61715
+ "azure": [240, 255, 255],
61716
+ "beige": [245, 245, 220],
61717
+ "bisque": [255, 228, 196],
61718
+ "black": [0, 0, 0],
61719
+ "blanchedalmond": [255, 235, 205],
61720
+ "blue": [0, 0, 255],
61721
+ "blueviolet": [138, 43, 226],
61722
+ "brown": [165, 42, 42],
61723
+ "burlywood": [222, 184, 135],
61724
+ "cadetblue": [95, 158, 160],
61725
+ "chartreuse": [127, 255, 0],
61726
+ "chocolate": [210, 105, 30],
61727
+ "coral": [255, 127, 80],
61728
+ "cornflowerblue": [100, 149, 237],
61729
+ "cornsilk": [255, 248, 220],
61730
+ "crimson": [220, 20, 60],
61731
+ "cyan": [0, 255, 255],
61732
+ "darkblue": [0, 0, 139],
61733
+ "darkcyan": [0, 139, 139],
61734
+ "darkgoldenrod": [184, 134, 11],
61735
+ "darkgray": [169, 169, 169],
61736
+ "darkgreen": [0, 100, 0],
61737
+ "darkgrey": [169, 169, 169],
61738
+ "darkkhaki": [189, 183, 107],
61739
+ "darkmagenta": [139, 0, 139],
61740
+ "darkolivegreen": [85, 107, 47],
61741
+ "darkorange": [255, 140, 0],
61742
+ "darkorchid": [153, 50, 204],
61743
+ "darkred": [139, 0, 0],
61744
+ "darksalmon": [233, 150, 122],
61745
+ "darkseagreen": [143, 188, 143],
61746
+ "darkslateblue": [72, 61, 139],
61747
+ "darkslategray": [47, 79, 79],
61748
+ "darkslategrey": [47, 79, 79],
61749
+ "darkturquoise": [0, 206, 209],
61750
+ "darkviolet": [148, 0, 211],
61751
+ "deeppink": [255, 20, 147],
61752
+ "deepskyblue": [0, 191, 255],
61753
+ "dimgray": [105, 105, 105],
61754
+ "dimgrey": [105, 105, 105],
61755
+ "dodgerblue": [30, 144, 255],
61756
+ "firebrick": [178, 34, 34],
61757
+ "floralwhite": [255, 250, 240],
61758
+ "forestgreen": [34, 139, 34],
61759
+ "fuchsia": [255, 0, 255],
61760
+ "gainsboro": [220, 220, 220],
61761
+ "ghostwhite": [248, 248, 255],
61762
+ "gold": [255, 215, 0],
61763
+ "goldenrod": [218, 165, 32],
61764
+ "gray": [128, 128, 128],
61765
+ "green": [0, 128, 0],
61766
+ "greenyellow": [173, 255, 47],
61767
+ "grey": [128, 128, 128],
61768
+ "honeydew": [240, 255, 240],
61769
+ "hotpink": [255, 105, 180],
61770
+ "indianred": [205, 92, 92],
61771
+ "indigo": [75, 0, 130],
61772
+ "ivory": [255, 255, 240],
61773
+ "khaki": [240, 230, 140],
61774
+ "lavender": [230, 230, 250],
61775
+ "lavenderblush": [255, 240, 245],
61776
+ "lawngreen": [124, 252, 0],
61777
+ "lemonchiffon": [255, 250, 205],
61778
+ "lightblue": [173, 216, 230],
61779
+ "lightcoral": [240, 128, 128],
61780
+ "lightcyan": [224, 255, 255],
61781
+ "lightgoldenrodyellow": [250, 250, 210],
61782
+ "lightgray": [211, 211, 211],
61783
+ "lightgreen": [144, 238, 144],
61784
+ "lightgrey": [211, 211, 211],
61785
+ "lightpink": [255, 182, 193],
61786
+ "lightsalmon": [255, 160, 122],
61787
+ "lightseagreen": [32, 178, 170],
61788
+ "lightskyblue": [135, 206, 250],
61789
+ "lightslategray": [119, 136, 153],
61790
+ "lightslategrey": [119, 136, 153],
61791
+ "lightsteelblue": [176, 196, 222],
61792
+ "lightyellow": [255, 255, 224],
61793
+ "lime": [0, 255, 0],
61794
+ "limegreen": [50, 205, 50],
61795
+ "linen": [250, 240, 230],
61796
+ "magenta": [255, 0, 255],
61797
+ "maroon": [128, 0, 0],
61798
+ "mediumaquamarine": [102, 205, 170],
61799
+ "mediumblue": [0, 0, 205],
61800
+ "mediumorchid": [186, 85, 211],
61801
+ "mediumpurple": [147, 112, 219],
61802
+ "mediumseagreen": [60, 179, 113],
61803
+ "mediumslateblue": [123, 104, 238],
61804
+ "mediumspringgreen": [0, 250, 154],
61805
+ "mediumturquoise": [72, 209, 204],
61806
+ "mediumvioletred": [199, 21, 133],
61807
+ "midnightblue": [25, 25, 112],
61808
+ "mintcream": [245, 255, 250],
61809
+ "mistyrose": [255, 228, 225],
61810
+ "moccasin": [255, 228, 181],
61811
+ "navajowhite": [255, 222, 173],
61812
+ "navy": [0, 0, 128],
61813
+ "oldlace": [253, 245, 230],
61814
+ "olive": [128, 128, 0],
61815
+ "olivedrab": [107, 142, 35],
61816
+ "orange": [255, 165, 0],
61817
+ "orangered": [255, 69, 0],
61818
+ "orchid": [218, 112, 214],
61819
+ "palegoldenrod": [238, 232, 170],
61820
+ "palegreen": [152, 251, 152],
61821
+ "paleturquoise": [175, 238, 238],
61822
+ "palevioletred": [219, 112, 147],
61823
+ "papayawhip": [255, 239, 213],
61824
+ "peachpuff": [255, 218, 185],
61825
+ "peru": [205, 133, 63],
61826
+ "pink": [255, 192, 203],
61827
+ "plum": [221, 160, 221],
61828
+ "powderblue": [176, 224, 230],
61829
+ "purple": [128, 0, 128],
61830
+ "rebeccapurple": [102, 51, 153],
61831
+ "red": [255, 0, 0],
61832
+ "rosybrown": [188, 143, 143],
61833
+ "royalblue": [65, 105, 225],
61834
+ "saddlebrown": [139, 69, 19],
61835
+ "salmon": [250, 128, 114],
61836
+ "sandybrown": [244, 164, 96],
61837
+ "seagreen": [46, 139, 87],
61838
+ "seashell": [255, 245, 238],
61839
+ "sienna": [160, 82, 45],
61840
+ "silver": [192, 192, 192],
61841
+ "skyblue": [135, 206, 235],
61842
+ "slateblue": [106, 90, 205],
61843
+ "slategray": [112, 128, 144],
61844
+ "slategrey": [112, 128, 144],
61845
+ "snow": [255, 250, 250],
61846
+ "springgreen": [0, 255, 127],
61847
+ "steelblue": [70, 130, 180],
61848
+ "tan": [210, 180, 140],
61849
+ "teal": [0, 128, 128],
61850
+ "thistle": [216, 191, 216],
61851
+ "tomato": [255, 99, 71],
61852
+ "turquoise": [64, 224, 208],
61853
+ "violet": [238, 130, 238],
61854
+ "wheat": [245, 222, 179],
61855
+ "white": [255, 255, 255],
61856
+ "whitesmoke": [245, 245, 245],
61857
+ "yellow": [255, 255, 0],
61858
+ "yellowgreen": [154, 205, 50]
61859
+ };
61860
+
61861
+ /***/ }),
61862
+
61863
+ /***/ "./node_modules/color-string/index.js":
61864
+ /*!********************************************!*\
61865
+ !*** ./node_modules/color-string/index.js ***!
61866
+ \********************************************/
61867
+ /*! no static exports found */
61868
+ /***/ (function(module, exports, __webpack_require__) {
61869
+
61870
+ /* MIT license */
61871
+ var colorNames = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
61872
+ var swizzle = __webpack_require__(/*! simple-swizzle */ "./node_modules/simple-swizzle/index.js");
61873
+ var hasOwnProperty = Object.hasOwnProperty;
61874
+ var reverseNames = Object.create(null);
61875
+
61876
+ // create a list of reverse color names
61877
+ for (var name in colorNames) {
61878
+ if (hasOwnProperty.call(colorNames, name)) {
61879
+ reverseNames[colorNames[name]] = name;
61725
61880
  }
61726
61881
  }
61727
- var convert = module.exports = {
61728
- rgb: {
61729
- channels: 3,
61730
- labels: 'rgb'
61731
- },
61732
- hsl: {
61733
- channels: 3,
61734
- labels: 'hsl'
61735
- },
61736
- hsv: {
61737
- channels: 3,
61738
- labels: 'hsv'
61739
- },
61740
- hwb: {
61741
- channels: 3,
61742
- labels: 'hwb'
61743
- },
61744
- cmyk: {
61745
- channels: 4,
61746
- labels: 'cmyk'
61747
- },
61748
- xyz: {
61749
- channels: 3,
61750
- labels: 'xyz'
61751
- },
61752
- lab: {
61753
- channels: 3,
61754
- labels: 'lab'
61755
- },
61756
- lch: {
61757
- channels: 3,
61758
- labels: 'lch'
61759
- },
61760
- hex: {
61761
- channels: 1,
61762
- labels: ['hex']
61763
- },
61764
- keyword: {
61765
- channels: 1,
61766
- labels: ['keyword']
61767
- },
61768
- ansi16: {
61769
- channels: 1,
61770
- labels: ['ansi16']
61771
- },
61772
- ansi256: {
61773
- channels: 1,
61774
- labels: ['ansi256']
61775
- },
61776
- hcg: {
61777
- channels: 3,
61778
- labels: ['h', 'c', 'g']
61779
- },
61780
- apple: {
61781
- channels: 3,
61782
- labels: ['r16', 'g16', 'b16']
61783
- },
61784
- gray: {
61785
- channels: 1,
61786
- labels: ['gray']
61882
+ var cs = module.exports = {
61883
+ to: {},
61884
+ get: {}
61885
+ };
61886
+ cs.get = function (string) {
61887
+ var prefix = string.substring(0, 3).toLowerCase();
61888
+ var val;
61889
+ var model;
61890
+ switch (prefix) {
61891
+ case 'hsl':
61892
+ val = cs.get.hsl(string);
61893
+ model = 'hsl';
61894
+ break;
61895
+ case 'hwb':
61896
+ val = cs.get.hwb(string);
61897
+ model = 'hwb';
61898
+ break;
61899
+ default:
61900
+ val = cs.get.rgb(string);
61901
+ model = 'rgb';
61902
+ break;
61903
+ }
61904
+ if (!val) {
61905
+ return null;
61787
61906
  }
61907
+ return {
61908
+ model: model,
61909
+ value: val
61910
+ };
61788
61911
  };
61789
-
61790
- // hide .channels and .labels properties
61791
- for (var model in convert) {
61792
- if (convert.hasOwnProperty(model)) {
61793
- if (!('channels' in convert[model])) {
61794
- throw new Error('missing channels property: ' + model);
61912
+ cs.get.rgb = function (string) {
61913
+ if (!string) {
61914
+ return null;
61915
+ }
61916
+ var abbr = /^#([a-f0-9]{3,4})$/i;
61917
+ var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
61918
+ var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
61919
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
61920
+ var keyword = /^(\w+)$/;
61921
+ var rgb = [0, 0, 0, 1];
61922
+ var match;
61923
+ var i;
61924
+ var hexAlpha;
61925
+ if (match = string.match(hex)) {
61926
+ hexAlpha = match[2];
61927
+ match = match[1];
61928
+ for (i = 0; i < 3; i++) {
61929
+ // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
61930
+ var i2 = i * 2;
61931
+ rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
61932
+ }
61933
+ if (hexAlpha) {
61934
+ rgb[3] = parseInt(hexAlpha, 16) / 255;
61935
+ }
61936
+ } else if (match = string.match(abbr)) {
61937
+ match = match[1];
61938
+ hexAlpha = match[3];
61939
+ for (i = 0; i < 3; i++) {
61940
+ rgb[i] = parseInt(match[i] + match[i], 16);
61795
61941
  }
61796
- if (!('labels' in convert[model])) {
61797
- throw new Error('missing channel labels property: ' + model);
61942
+ if (hexAlpha) {
61943
+ rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
61798
61944
  }
61799
- if (convert[model].labels.length !== convert[model].channels) {
61800
- throw new Error('channel and label counts mismatch: ' + model);
61945
+ } else if (match = string.match(rgba)) {
61946
+ for (i = 0; i < 3; i++) {
61947
+ rgb[i] = parseInt(match[i + 1], 0);
61801
61948
  }
61802
- var channels = convert[model].channels;
61803
- var labels = convert[model].labels;
61804
- delete convert[model].channels;
61805
- delete convert[model].labels;
61806
- Object.defineProperty(convert[model], 'channels', {
61807
- value: channels
61808
- });
61809
- Object.defineProperty(convert[model], 'labels', {
61810
- value: labels
61811
- });
61949
+ if (match[4]) {
61950
+ if (match[5]) {
61951
+ rgb[3] = parseFloat(match[4]) * 0.01;
61952
+ } else {
61953
+ rgb[3] = parseFloat(match[4]);
61954
+ }
61955
+ }
61956
+ } else if (match = string.match(per)) {
61957
+ for (i = 0; i < 3; i++) {
61958
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
61959
+ }
61960
+ if (match[4]) {
61961
+ if (match[5]) {
61962
+ rgb[3] = parseFloat(match[4]) * 0.01;
61963
+ } else {
61964
+ rgb[3] = parseFloat(match[4]);
61965
+ }
61966
+ }
61967
+ } else if (match = string.match(keyword)) {
61968
+ if (match[1] === 'transparent') {
61969
+ return [0, 0, 0, 0];
61970
+ }
61971
+ if (!hasOwnProperty.call(colorNames, match[1])) {
61972
+ return null;
61973
+ }
61974
+ rgb = colorNames[match[1]];
61975
+ rgb[3] = 1;
61976
+ return rgb;
61977
+ } else {
61978
+ return null;
61812
61979
  }
61813
- }
61814
- convert.rgb.hsl = function (rgb) {
61815
- var r = rgb[0] / 255;
61816
- var g = rgb[1] / 255;
61817
- var b = rgb[2] / 255;
61818
- var min = Math.min(r, g, b);
61819
- var max = Math.max(r, g, b);
61820
- var delta = max - min;
61821
- var h;
61822
- var s;
61823
- var l;
61824
- if (max === min) {
61825
- h = 0;
61826
- } else if (r === max) {
61827
- h = (g - b) / delta;
61828
- } else if (g === max) {
61829
- h = 2 + (b - r) / delta;
61830
- } else if (b === max) {
61831
- h = 4 + (r - g) / delta;
61980
+ for (i = 0; i < 3; i++) {
61981
+ rgb[i] = clamp(rgb[i], 0, 255);
61832
61982
  }
61833
- h = Math.min(h * 60, 360);
61834
- if (h < 0) {
61835
- h += 360;
61983
+ rgb[3] = clamp(rgb[3], 0, 1);
61984
+ return rgb;
61985
+ };
61986
+ cs.get.hsl = function (string) {
61987
+ if (!string) {
61988
+ return null;
61836
61989
  }
61837
- l = (min + max) / 2;
61838
- if (max === min) {
61839
- s = 0;
61840
- } else if (l <= 0.5) {
61841
- s = delta / (max + min);
61842
- } else {
61843
- s = delta / (2 - max - min);
61990
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
61991
+ var match = string.match(hsl);
61992
+ if (match) {
61993
+ var alpha = parseFloat(match[4]);
61994
+ var h = (parseFloat(match[1]) % 360 + 360) % 360;
61995
+ var s = clamp(parseFloat(match[2]), 0, 100);
61996
+ var l = clamp(parseFloat(match[3]), 0, 100);
61997
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
61998
+ return [h, s, l, a];
61844
61999
  }
61845
- return [h, s * 100, l * 100];
62000
+ return null;
61846
62001
  };
61847
- convert.rgb.hsv = function (rgb) {
61848
- var rdif;
61849
- var gdif;
61850
- var bdif;
61851
- var h;
61852
- var s;
61853
- var r = rgb[0] / 255;
61854
- var g = rgb[1] / 255;
61855
- var b = rgb[2] / 255;
61856
- var v = Math.max(r, g, b);
61857
- var diff = v - Math.min(r, g, b);
61858
- var diffc = function diffc(c) {
61859
- return (v - c) / 6 / diff + 1 / 2;
61860
- };
61861
- if (diff === 0) {
61862
- h = s = 0;
61863
- } else {
61864
- s = diff / v;
61865
- rdif = diffc(r);
61866
- gdif = diffc(g);
61867
- bdif = diffc(b);
61868
- if (r === v) {
61869
- h = bdif - gdif;
61870
- } else if (g === v) {
61871
- h = 1 / 3 + rdif - bdif;
61872
- } else if (b === v) {
61873
- h = 2 / 3 + gdif - rdif;
61874
- }
61875
- if (h < 0) {
61876
- h += 1;
61877
- } else if (h > 1) {
61878
- h -= 1;
61879
- }
62002
+ cs.get.hwb = function (string) {
62003
+ if (!string) {
62004
+ return null;
61880
62005
  }
61881
- return [h * 360, s * 100, v * 100];
62006
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
62007
+ var match = string.match(hwb);
62008
+ if (match) {
62009
+ var alpha = parseFloat(match[4]);
62010
+ var h = (parseFloat(match[1]) % 360 + 360) % 360;
62011
+ var w = clamp(parseFloat(match[2]), 0, 100);
62012
+ var b = clamp(parseFloat(match[3]), 0, 100);
62013
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
62014
+ return [h, w, b, a];
62015
+ }
62016
+ return null;
61882
62017
  };
61883
- convert.rgb.hwb = function (rgb) {
61884
- var r = rgb[0];
61885
- var g = rgb[1];
61886
- var b = rgb[2];
61887
- var h = convert.rgb.hsl(rgb)[0];
61888
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
61889
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
61890
- return [h, w * 100, b * 100];
62018
+ cs.to.hex = function () {
62019
+ var rgba = swizzle(arguments);
62020
+ return '#' + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : '');
61891
62021
  };
61892
- convert.rgb.cmyk = function (rgb) {
61893
- var r = rgb[0] / 255;
61894
- var g = rgb[1] / 255;
61895
- var b = rgb[2] / 255;
61896
- var c;
61897
- var m;
61898
- var y;
61899
- var k;
61900
- k = Math.min(1 - r, 1 - g, 1 - b);
61901
- c = (1 - r - k) / (1 - k) || 0;
61902
- m = (1 - g - k) / (1 - k) || 0;
61903
- y = (1 - b - k) / (1 - k) || 0;
61904
- return [c * 100, m * 100, y * 100, k * 100];
62022
+ cs.to.rgb = function () {
62023
+ var rgba = swizzle(arguments);
62024
+ return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
62025
+ };
62026
+ cs.to.rgb.percent = function () {
62027
+ var rgba = swizzle(arguments);
62028
+ var r = Math.round(rgba[0] / 255 * 100);
62029
+ var g = Math.round(rgba[1] / 255 * 100);
62030
+ var b = Math.round(rgba[2] / 255 * 100);
62031
+ return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
62032
+ };
62033
+ cs.to.hsl = function () {
62034
+ var hsla = swizzle(arguments);
62035
+ return hsla.length < 4 || hsla[3] === 1 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
61905
62036
  };
61906
62037
 
61907
- /**
61908
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
61909
- * */
61910
- function comparativeDistance(x, y) {
61911
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
61912
- }
61913
- convert.rgb.keyword = function (rgb) {
61914
- var reversed = reverseKeywords[rgb];
61915
- if (reversed) {
61916
- return reversed;
61917
- }
61918
- var currentClosestDistance = Infinity;
61919
- var currentClosestKeyword;
61920
- for (var keyword in cssKeywords) {
61921
- if (cssKeywords.hasOwnProperty(keyword)) {
61922
- var value = cssKeywords[keyword];
61923
-
61924
- // Compute comparative distance
61925
- var distance = comparativeDistance(rgb, value);
61926
-
61927
- // Check if its less, if so set as closest
61928
- if (distance < currentClosestDistance) {
61929
- currentClosestDistance = distance;
61930
- currentClosestKeyword = keyword;
61931
- }
61932
- }
62038
+ // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
62039
+ // (hwb have alpha optional & 1 is default value)
62040
+ cs.to.hwb = function () {
62041
+ var hwba = swizzle(arguments);
62042
+ var a = '';
62043
+ if (hwba.length >= 4 && hwba[3] !== 1) {
62044
+ a = ', ' + hwba[3];
61933
62045
  }
61934
- return currentClosestKeyword;
62046
+ return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
61935
62047
  };
61936
- convert.keyword.rgb = function (keyword) {
61937
- return cssKeywords[keyword];
62048
+ cs.to.keyword = function (rgb) {
62049
+ return reverseNames[rgb.slice(0, 3)];
61938
62050
  };
61939
- convert.rgb.xyz = function (rgb) {
61940
- var r = rgb[0] / 255;
61941
- var g = rgb[1] / 255;
61942
- var b = rgb[2] / 255;
61943
62051
 
61944
- // assume sRGB
61945
- r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
61946
- g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
61947
- b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
61948
- var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
61949
- var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
61950
- var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
61951
- return [x * 100, y * 100, z * 100];
61952
- };
61953
- convert.rgb.lab = function (rgb) {
61954
- var xyz = convert.rgb.xyz(rgb);
61955
- var x = xyz[0];
61956
- var y = xyz[1];
61957
- var z = xyz[2];
61958
- var l;
61959
- var a;
61960
- var b;
61961
- x /= 95.047;
61962
- y /= 100;
61963
- z /= 108.883;
61964
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
61965
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
61966
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
61967
- l = 116 * y - 16;
61968
- a = 500 * (x - y);
61969
- b = 200 * (y - z);
61970
- return [l, a, b];
61971
- };
61972
- convert.hsl.rgb = function (hsl) {
61973
- var h = hsl[0] / 360;
61974
- var s = hsl[1] / 100;
61975
- var l = hsl[2] / 100;
61976
- var t1;
61977
- var t2;
61978
- var t3;
61979
- var rgb;
61980
- var val;
61981
- if (s === 0) {
61982
- val = l * 255;
61983
- return [val, val, val];
61984
- }
61985
- if (l < 0.5) {
61986
- t2 = l * (1 + s);
61987
- } else {
61988
- t2 = l + s - l * s;
61989
- }
61990
- t1 = 2 * l - t2;
61991
- rgb = [0, 0, 0];
61992
- for (var i = 0; i < 3; i++) {
61993
- t3 = h + 1 / 3 * -(i - 1);
61994
- if (t3 < 0) {
61995
- t3++;
61996
- }
61997
- if (t3 > 1) {
61998
- t3--;
61999
- }
62000
- if (6 * t3 < 1) {
62001
- val = t1 + (t2 - t1) * 6 * t3;
62002
- } else if (2 * t3 < 1) {
62003
- val = t2;
62004
- } else if (3 * t3 < 2) {
62005
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
62006
- } else {
62007
- val = t1;
62008
- }
62009
- rgb[i] = val * 255;
62010
- }
62011
- return rgb;
62012
- };
62013
- convert.hsl.hsv = function (hsl) {
62014
- var h = hsl[0];
62015
- var s = hsl[1] / 100;
62016
- var l = hsl[2] / 100;
62017
- var smin = s;
62018
- var lmin = Math.max(l, 0.01);
62019
- var sv;
62020
- var v;
62021
- l *= 2;
62022
- s *= l <= 1 ? l : 2 - l;
62023
- smin *= lmin <= 1 ? lmin : 2 - lmin;
62024
- v = (l + s) / 2;
62025
- sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
62026
- return [h, sv * 100, v * 100];
62027
- };
62028
- convert.hsv.rgb = function (hsv) {
62029
- var h = hsv[0] / 60;
62030
- var s = hsv[1] / 100;
62031
- var v = hsv[2] / 100;
62032
- var hi = Math.floor(h) % 6;
62033
- var f = h - Math.floor(h);
62034
- var p = 255 * v * (1 - s);
62035
- var q = 255 * v * (1 - s * f);
62036
- var t = 255 * v * (1 - s * (1 - f));
62037
- v *= 255;
62038
- switch (hi) {
62039
- case 0:
62040
- return [v, t, p];
62041
- case 1:
62042
- return [q, v, p];
62043
- case 2:
62044
- return [p, v, t];
62045
- case 3:
62046
- return [p, q, v];
62047
- case 4:
62048
- return [t, p, v];
62049
- case 5:
62050
- return [v, p, q];
62051
- }
62052
- };
62053
- convert.hsv.hsl = function (hsv) {
62054
- var h = hsv[0];
62055
- var s = hsv[1] / 100;
62056
- var v = hsv[2] / 100;
62057
- var vmin = Math.max(v, 0.01);
62058
- var lmin;
62059
- var sl;
62060
- var l;
62061
- l = (2 - s) * v;
62062
- lmin = (2 - s) * vmin;
62063
- sl = s * vmin;
62064
- sl /= lmin <= 1 ? lmin : 2 - lmin;
62065
- sl = sl || 0;
62066
- l /= 2;
62067
- return [h, sl * 100, l * 100];
62068
- };
62069
-
62070
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
62071
- convert.hwb.rgb = function (hwb) {
62072
- var h = hwb[0] / 360;
62073
- var wh = hwb[1] / 100;
62074
- var bl = hwb[2] / 100;
62075
- var ratio = wh + bl;
62076
- var i;
62077
- var v;
62078
- var f;
62079
- var n;
62052
+ // helpers
62053
+ function clamp(num, min, max) {
62054
+ return Math.min(Math.max(min, num), max);
62055
+ }
62056
+ function hexDouble(num) {
62057
+ var str = Math.round(num).toString(16).toUpperCase();
62058
+ return str.length < 2 ? '0' + str : str;
62059
+ }
62080
62060
 
62081
- // wh + bl cant be > 1
62082
- if (ratio > 1) {
62083
- wh /= ratio;
62084
- bl /= ratio;
62085
- }
62086
- i = Math.floor(6 * h);
62087
- v = 1 - bl;
62088
- f = 6 * h - i;
62089
- if ((i & 0x01) !== 0) {
62090
- f = 1 - f;
62091
- }
62092
- n = wh + f * (v - wh); // linear interpolation
62061
+ /***/ }),
62093
62062
 
62094
- var r;
62095
- var g;
62096
- var b;
62097
- switch (i) {
62098
- default:
62099
- case 6:
62100
- case 0:
62101
- r = v;
62102
- g = n;
62103
- b = wh;
62104
- break;
62105
- case 1:
62106
- r = n;
62107
- g = v;
62108
- b = wh;
62109
- break;
62110
- case 2:
62111
- r = wh;
62112
- g = v;
62113
- b = n;
62114
- break;
62115
- case 3:
62116
- r = wh;
62117
- g = n;
62118
- b = v;
62119
- break;
62120
- case 4:
62121
- r = n;
62122
- g = wh;
62123
- b = v;
62124
- break;
62125
- case 5:
62126
- r = v;
62127
- g = wh;
62128
- b = n;
62129
- break;
62130
- }
62131
- return [r * 255, g * 255, b * 255];
62132
- };
62133
- convert.cmyk.rgb = function (cmyk) {
62134
- var c = cmyk[0] / 100;
62135
- var m = cmyk[1] / 100;
62136
- var y = cmyk[2] / 100;
62137
- var k = cmyk[3] / 100;
62138
- var r;
62139
- var g;
62140
- var b;
62141
- r = 1 - Math.min(1, c * (1 - k) + k);
62142
- g = 1 - Math.min(1, m * (1 - k) + k);
62143
- b = 1 - Math.min(1, y * (1 - k) + k);
62144
- return [r * 255, g * 255, b * 255];
62145
- };
62146
- convert.xyz.rgb = function (xyz) {
62147
- var x = xyz[0] / 100;
62148
- var y = xyz[1] / 100;
62149
- var z = xyz[2] / 100;
62150
- var r;
62151
- var g;
62152
- var b;
62153
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
62154
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
62155
- b = x * 0.0557 + y * -0.2040 + z * 1.0570;
62063
+ /***/ "./node_modules/color/index.js":
62064
+ /*!*************************************!*\
62065
+ !*** ./node_modules/color/index.js ***!
62066
+ \*************************************/
62067
+ /*! no static exports found */
62068
+ /***/ (function(module, exports, __webpack_require__) {
62156
62069
 
62157
- // assume sRGB
62158
- r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
62159
- g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
62160
- b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
62161
- r = Math.min(Math.max(0, r), 1);
62162
- g = Math.min(Math.max(0, g), 1);
62163
- b = Math.min(Math.max(0, b), 1);
62164
- return [r * 255, g * 255, b * 255];
62165
- };
62166
- convert.xyz.lab = function (xyz) {
62167
- var x = xyz[0];
62168
- var y = xyz[1];
62169
- var z = xyz[2];
62170
- var l;
62171
- var a;
62172
- var b;
62173
- x /= 95.047;
62174
- y /= 100;
62175
- z /= 108.883;
62176
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
62177
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
62178
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
62179
- l = 116 * y - 16;
62180
- a = 500 * (x - y);
62181
- b = 200 * (y - z);
62182
- return [l, a, b];
62183
- };
62184
- convert.lab.xyz = function (lab) {
62185
- var l = lab[0];
62186
- var a = lab[1];
62187
- var b = lab[2];
62188
- var x;
62189
- var y;
62190
- var z;
62191
- y = (l + 16) / 116;
62192
- x = a / 500 + y;
62193
- z = y - b / 200;
62194
- var y2 = Math.pow(y, 3);
62195
- var x2 = Math.pow(x, 3);
62196
- var z2 = Math.pow(z, 3);
62197
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
62198
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
62199
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
62200
- x *= 95.047;
62201
- y *= 100;
62202
- z *= 108.883;
62203
- return [x, y, z];
62204
- };
62205
- convert.lab.lch = function (lab) {
62206
- var l = lab[0];
62207
- var a = lab[1];
62208
- var b = lab[2];
62209
- var hr;
62210
- var h;
62211
- var c;
62212
- hr = Math.atan2(b, a);
62213
- h = hr * 360 / 2 / Math.PI;
62214
- if (h < 0) {
62215
- h += 360;
62070
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
62071
+ var _slicedToArray = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
62072
+ var _toConsumableArray = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
62073
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
62074
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
62075
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
62076
+ var colorString = __webpack_require__(/*! color-string */ "./node_modules/color-string/index.js");
62077
+ var convert = __webpack_require__(/*! color-convert */ "./node_modules/color/node_modules/color-convert/index.js");
62078
+ var skippedModels = [
62079
+ // To be honest, I don't really feel like keyword belongs in color convert, but eh.
62080
+ 'keyword',
62081
+ // Gray conflicts with some method names, and has its own method defined.
62082
+ 'gray',
62083
+ // Shouldn't really be in color-convert either...
62084
+ 'hex'];
62085
+ var hashedModelKeys = {};
62086
+ for (var _i = 0, _Object$keys = Object.keys(convert); _i < _Object$keys.length; _i++) {
62087
+ var model = _Object$keys[_i];
62088
+ hashedModelKeys[_toConsumableArray(convert[model].labels).sort().join('')] = model;
62089
+ }
62090
+ var limiters = {};
62091
+ function Color(object, model) {
62092
+ if (!(this instanceof Color)) {
62093
+ return new Color(object, model);
62216
62094
  }
62217
- c = Math.sqrt(a * a + b * b);
62218
- return [l, c, h];
62219
- };
62220
- convert.lch.lab = function (lch) {
62221
- var l = lch[0];
62222
- var c = lch[1];
62223
- var h = lch[2];
62224
- var a;
62225
- var b;
62226
- var hr;
62227
- hr = h / 360 * 2 * Math.PI;
62228
- a = c * Math.cos(hr);
62229
- b = c * Math.sin(hr);
62230
- return [l, a, b];
62231
- };
62232
- convert.rgb.ansi16 = function (args) {
62233
- var r = args[0];
62234
- var g = args[1];
62235
- var b = args[2];
62236
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
62237
-
62238
- value = Math.round(value / 50);
62239
- if (value === 0) {
62240
- return 30;
62095
+ if (model && model in skippedModels) {
62096
+ model = null;
62241
62097
  }
62242
- var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
62243
- if (value === 2) {
62244
- ansi += 60;
62098
+ if (model && !(model in convert)) {
62099
+ throw new Error('Unknown model: ' + model);
62245
62100
  }
62246
- return ansi;
62247
- };
62248
- convert.hsv.ansi16 = function (args) {
62249
- // optimization here; we already know the value and don't need to get
62250
- // it converted for us.
62251
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
62252
- };
62253
- convert.rgb.ansi256 = function (args) {
62254
- var r = args[0];
62255
- var g = args[1];
62256
- var b = args[2];
62257
-
62258
- // we use the extended greyscale palette here, with the exception of
62259
- // black and white. normal palette only has 4 greyscale shades.
62260
- if (r === g && g === b) {
62261
- if (r < 8) {
62262
- return 16;
62101
+ var i;
62102
+ var channels;
62103
+ if (object == null) {
62104
+ // eslint-disable-line no-eq-null,eqeqeq
62105
+ this.model = 'rgb';
62106
+ this.color = [0, 0, 0];
62107
+ this.valpha = 1;
62108
+ } else if (object instanceof Color) {
62109
+ this.model = object.model;
62110
+ this.color = _toConsumableArray(object.color);
62111
+ this.valpha = object.valpha;
62112
+ } else if (typeof object === 'string') {
62113
+ var result = colorString.get(object);
62114
+ if (result === null) {
62115
+ throw new Error('Unable to parse color from string: ' + object);
62263
62116
  }
62264
- if (r > 248) {
62265
- return 231;
62117
+ this.model = result.model;
62118
+ channels = convert[this.model].channels;
62119
+ this.color = result.value.slice(0, channels);
62120
+ this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
62121
+ } else if (object.length > 0) {
62122
+ this.model = model || 'rgb';
62123
+ channels = convert[this.model].channels;
62124
+ var newArray = Array.prototype.slice.call(object, 0, channels);
62125
+ this.color = zeroArray(newArray, channels);
62126
+ this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
62127
+ } else if (typeof object === 'number') {
62128
+ // This is always RGB - can be converted later on.
62129
+ this.model = 'rgb';
62130
+ this.color = [object >> 16 & 0xFF, object >> 8 & 0xFF, object & 0xFF];
62131
+ this.valpha = 1;
62132
+ } else {
62133
+ this.valpha = 1;
62134
+ var keys = Object.keys(object);
62135
+ if ('alpha' in object) {
62136
+ keys.splice(keys.indexOf('alpha'), 1);
62137
+ this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
62266
62138
  }
62267
- return Math.round((r - 8) / 247 * 24) + 232;
62139
+ var hashedKeys = keys.sort().join('');
62140
+ if (!(hashedKeys in hashedModelKeys)) {
62141
+ throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
62142
+ }
62143
+ this.model = hashedModelKeys[hashedKeys];
62144
+ var labels = convert[this.model].labels;
62145
+ var color = [];
62146
+ for (i = 0; i < labels.length; i++) {
62147
+ color.push(object[labels[i]]);
62148
+ }
62149
+ this.color = zeroArray(color);
62268
62150
  }
62269
- var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
62270
- return ansi;
62271
- };
62272
- convert.ansi16.rgb = function (args) {
62273
- var color = args % 10;
62274
62151
 
62275
- // handle greyscale
62276
- if (color === 0 || color === 7) {
62277
- if (args > 50) {
62278
- color += 3.5;
62152
+ // Perform limitations (clamping, etc.)
62153
+ if (limiters[this.model]) {
62154
+ channels = convert[this.model].channels;
62155
+ for (i = 0; i < channels; i++) {
62156
+ var limit = limiters[this.model][i];
62157
+ if (limit) {
62158
+ this.color[i] = limit(this.color[i]);
62159
+ }
62279
62160
  }
62280
- color = color / 10.5 * 255;
62281
- return [color, color, color];
62282
- }
62283
- var mult = (~~(args > 50) + 1) * 0.5;
62284
- var r = (color & 1) * mult * 255;
62285
- var g = (color >> 1 & 1) * mult * 255;
62286
- var b = (color >> 2 & 1) * mult * 255;
62287
- return [r, g, b];
62288
- };
62289
- convert.ansi256.rgb = function (args) {
62290
- // handle greyscale
62291
- if (args >= 232) {
62292
- var c = (args - 232) * 10 + 8;
62293
- return [c, c, c];
62294
62161
  }
62295
- args -= 16;
62296
- var rem;
62297
- var r = Math.floor(args / 36) / 5 * 255;
62298
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
62299
- var b = rem % 6 / 5 * 255;
62300
- return [r, g, b];
62301
- };
62302
- convert.rgb.hex = function (args) {
62303
- var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
62304
- var string = integer.toString(16).toUpperCase();
62305
- return '000000'.substring(string.length) + string;
62306
- };
62307
- convert.hex.rgb = function (args) {
62308
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
62309
- if (!match) {
62310
- return [0, 0, 0];
62311
- }
62312
- var colorString = match[0];
62313
- if (match[0].length === 3) {
62314
- colorString = colorString.split('').map(function (char) {
62315
- return char + char;
62316
- }).join('');
62317
- }
62318
- var integer = parseInt(colorString, 16);
62319
- var r = integer >> 16 & 0xFF;
62320
- var g = integer >> 8 & 0xFF;
62321
- var b = integer & 0xFF;
62322
- return [r, g, b];
62323
- };
62324
- convert.rgb.hcg = function (rgb) {
62325
- var r = rgb[0] / 255;
62326
- var g = rgb[1] / 255;
62327
- var b = rgb[2] / 255;
62328
- var max = Math.max(Math.max(r, g), b);
62329
- var min = Math.min(Math.min(r, g), b);
62330
- var chroma = max - min;
62331
- var grayscale;
62332
- var hue;
62333
- if (chroma < 1) {
62334
- grayscale = min / (1 - chroma);
62335
- } else {
62336
- grayscale = 0;
62337
- }
62338
- if (chroma <= 0) {
62339
- hue = 0;
62340
- } else if (max === r) {
62341
- hue = (g - b) / chroma % 6;
62342
- } else if (max === g) {
62343
- hue = 2 + (b - r) / chroma;
62344
- } else {
62345
- hue = 4 + (r - g) / chroma + 4;
62346
- }
62347
- hue /= 6;
62348
- hue %= 1;
62349
- return [hue * 360, chroma * 100, grayscale * 100];
62350
- };
62351
- convert.hsl.hcg = function (hsl) {
62352
- var s = hsl[1] / 100;
62353
- var l = hsl[2] / 100;
62354
- var c = 1;
62355
- var f = 0;
62356
- if (l < 0.5) {
62357
- c = 2.0 * s * l;
62358
- } else {
62359
- c = 2.0 * s * (1.0 - l);
62360
- }
62361
- if (c < 1.0) {
62362
- f = (l - 0.5 * c) / (1.0 - c);
62363
- }
62364
- return [hsl[0], c * 100, f * 100];
62365
- };
62366
- convert.hsv.hcg = function (hsv) {
62367
- var s = hsv[1] / 100;
62368
- var v = hsv[2] / 100;
62369
- var c = s * v;
62370
- var f = 0;
62371
- if (c < 1.0) {
62372
- f = (v - c) / (1 - c);
62373
- }
62374
- return [hsv[0], c * 100, f * 100];
62375
- };
62376
- convert.hcg.rgb = function (hcg) {
62377
- var h = hcg[0] / 360;
62378
- var c = hcg[1] / 100;
62379
- var g = hcg[2] / 100;
62380
- if (c === 0.0) {
62381
- return [g * 255, g * 255, g * 255];
62382
- }
62383
- var pure = [0, 0, 0];
62384
- var hi = h % 1 * 6;
62385
- var v = hi % 1;
62386
- var w = 1 - v;
62387
- var mg = 0;
62388
- switch (Math.floor(hi)) {
62389
- case 0:
62390
- pure[0] = 1;
62391
- pure[1] = v;
62392
- pure[2] = 0;
62393
- break;
62394
- case 1:
62395
- pure[0] = w;
62396
- pure[1] = 1;
62397
- pure[2] = 0;
62398
- break;
62399
- case 2:
62400
- pure[0] = 0;
62401
- pure[1] = 1;
62402
- pure[2] = v;
62403
- break;
62404
- case 3:
62405
- pure[0] = 0;
62406
- pure[1] = w;
62407
- pure[2] = 1;
62408
- break;
62409
- case 4:
62410
- pure[0] = v;
62411
- pure[1] = 0;
62412
- pure[2] = 1;
62413
- break;
62414
- default:
62415
- pure[0] = 1;
62416
- pure[1] = 0;
62417
- pure[2] = w;
62418
- }
62419
- mg = (1.0 - c) * g;
62420
- return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
62421
- };
62422
- convert.hcg.hsv = function (hcg) {
62423
- var c = hcg[1] / 100;
62424
- var g = hcg[2] / 100;
62425
- var v = c + g * (1.0 - c);
62426
- var f = 0;
62427
- if (v > 0.0) {
62428
- f = c / v;
62429
- }
62430
- return [hcg[0], f * 100, v * 100];
62431
- };
62432
- convert.hcg.hsl = function (hcg) {
62433
- var c = hcg[1] / 100;
62434
- var g = hcg[2] / 100;
62435
- var l = g * (1.0 - c) + 0.5 * c;
62436
- var s = 0;
62437
- if (l > 0.0 && l < 0.5) {
62438
- s = c / (2 * l);
62439
- } else if (l >= 0.5 && l < 1.0) {
62440
- s = c / (2 * (1 - l));
62162
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
62163
+ if (Object.freeze) {
62164
+ Object.freeze(this);
62441
62165
  }
62442
- return [hcg[0], s * 100, l * 100];
62443
- };
62444
- convert.hcg.hwb = function (hcg) {
62445
- var c = hcg[1] / 100;
62446
- var g = hcg[2] / 100;
62447
- var v = c + g * (1.0 - c);
62448
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
62449
- };
62450
- convert.hwb.hcg = function (hwb) {
62451
- var w = hwb[1] / 100;
62452
- var b = hwb[2] / 100;
62453
- var v = 1 - b;
62454
- var c = v - w;
62455
- var g = 0;
62456
- if (c < 1) {
62457
- g = (v - c) / (1 - c);
62166
+ }
62167
+ Color.prototype = {
62168
+ toString: function toString() {
62169
+ return this.string();
62170
+ },
62171
+ toJSON: function toJSON() {
62172
+ return this[this.model]();
62173
+ },
62174
+ string: function string(places) {
62175
+ var self = this.model in colorString.to ? this : this.rgb();
62176
+ self = self.round(typeof places === 'number' ? places : 1);
62177
+ var args = self.valpha === 1 ? self.color : [].concat(_toConsumableArray(self.color), [this.valpha]);
62178
+ return colorString.to[self.model](args);
62179
+ },
62180
+ percentString: function percentString(places) {
62181
+ var self = this.rgb().round(typeof places === 'number' ? places : 1);
62182
+ var args = self.valpha === 1 ? self.color : [].concat(_toConsumableArray(self.color), [this.valpha]);
62183
+ return colorString.to.rgb.percent(args);
62184
+ },
62185
+ array: function array() {
62186
+ return this.valpha === 1 ? _toConsumableArray(this.color) : [].concat(_toConsumableArray(this.color), [this.valpha]);
62187
+ },
62188
+ object: function object() {
62189
+ var result = {};
62190
+ var channels = convert[this.model].channels;
62191
+ var labels = convert[this.model].labels;
62192
+ for (var i = 0; i < channels; i++) {
62193
+ result[labels[i]] = this.color[i];
62194
+ }
62195
+ if (this.valpha !== 1) {
62196
+ result.alpha = this.valpha;
62197
+ }
62198
+ return result;
62199
+ },
62200
+ unitArray: function unitArray() {
62201
+ var rgb = this.rgb().color;
62202
+ rgb[0] /= 255;
62203
+ rgb[1] /= 255;
62204
+ rgb[2] /= 255;
62205
+ if (this.valpha !== 1) {
62206
+ rgb.push(this.valpha);
62207
+ }
62208
+ return rgb;
62209
+ },
62210
+ unitObject: function unitObject() {
62211
+ var rgb = this.rgb().object();
62212
+ rgb.r /= 255;
62213
+ rgb.g /= 255;
62214
+ rgb.b /= 255;
62215
+ if (this.valpha !== 1) {
62216
+ rgb.alpha = this.valpha;
62217
+ }
62218
+ return rgb;
62219
+ },
62220
+ round: function round(places) {
62221
+ places = Math.max(places || 0, 0);
62222
+ return new Color([].concat(_toConsumableArray(this.color.map(roundToPlace(places))), [this.valpha]), this.model);
62223
+ },
62224
+ alpha: function alpha(value) {
62225
+ if (value !== undefined) {
62226
+ return new Color([].concat(_toConsumableArray(this.color), [Math.max(0, Math.min(1, value))]), this.model);
62227
+ }
62228
+ return this.valpha;
62229
+ },
62230
+ // Rgb
62231
+ red: getset('rgb', 0, maxfn(255)),
62232
+ green: getset('rgb', 1, maxfn(255)),
62233
+ blue: getset('rgb', 2, maxfn(255)),
62234
+ hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (value) {
62235
+ return (value % 360 + 360) % 360;
62236
+ }),
62237
+ saturationl: getset('hsl', 1, maxfn(100)),
62238
+ lightness: getset('hsl', 2, maxfn(100)),
62239
+ saturationv: getset('hsv', 1, maxfn(100)),
62240
+ value: getset('hsv', 2, maxfn(100)),
62241
+ chroma: getset('hcg', 1, maxfn(100)),
62242
+ gray: getset('hcg', 2, maxfn(100)),
62243
+ white: getset('hwb', 1, maxfn(100)),
62244
+ wblack: getset('hwb', 2, maxfn(100)),
62245
+ cyan: getset('cmyk', 0, maxfn(100)),
62246
+ magenta: getset('cmyk', 1, maxfn(100)),
62247
+ yellow: getset('cmyk', 2, maxfn(100)),
62248
+ black: getset('cmyk', 3, maxfn(100)),
62249
+ x: getset('xyz', 0, maxfn(95.047)),
62250
+ y: getset('xyz', 1, maxfn(100)),
62251
+ z: getset('xyz', 2, maxfn(108.833)),
62252
+ l: getset('lab', 0, maxfn(100)),
62253
+ a: getset('lab', 1),
62254
+ b: getset('lab', 2),
62255
+ keyword: function keyword(value) {
62256
+ if (value !== undefined) {
62257
+ return new Color(value);
62258
+ }
62259
+ return convert[this.model].keyword(this.color);
62260
+ },
62261
+ hex: function hex(value) {
62262
+ if (value !== undefined) {
62263
+ return new Color(value);
62264
+ }
62265
+ return colorString.to.hex(this.rgb().round().color);
62266
+ },
62267
+ hexa: function hexa(value) {
62268
+ if (value !== undefined) {
62269
+ return new Color(value);
62270
+ }
62271
+ var rgbArray = this.rgb().round().color;
62272
+ var alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
62273
+ if (alphaHex.length === 1) {
62274
+ alphaHex = '0' + alphaHex;
62275
+ }
62276
+ return colorString.to.hex(rgbArray) + alphaHex;
62277
+ },
62278
+ rgbNumber: function rgbNumber() {
62279
+ var rgb = this.rgb().color;
62280
+ return (rgb[0] & 0xFF) << 16 | (rgb[1] & 0xFF) << 8 | rgb[2] & 0xFF;
62281
+ },
62282
+ luminosity: function luminosity() {
62283
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
62284
+ var rgb = this.rgb().color;
62285
+ var lum = [];
62286
+ var _iterator = _createForOfIteratorHelper(rgb.entries()),
62287
+ _step;
62288
+ try {
62289
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
62290
+ var _step$value = _slicedToArray(_step.value, 2),
62291
+ i = _step$value[0],
62292
+ element = _step$value[1];
62293
+ var chan = element / 255;
62294
+ lum[i] = chan <= 0.04045 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
62295
+ }
62296
+ } catch (err) {
62297
+ _iterator.e(err);
62298
+ } finally {
62299
+ _iterator.f();
62300
+ }
62301
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
62302
+ },
62303
+ contrast: function contrast(color2) {
62304
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
62305
+ var lum1 = this.luminosity();
62306
+ var lum2 = color2.luminosity();
62307
+ if (lum1 > lum2) {
62308
+ return (lum1 + 0.05) / (lum2 + 0.05);
62309
+ }
62310
+ return (lum2 + 0.05) / (lum1 + 0.05);
62311
+ },
62312
+ level: function level(color2) {
62313
+ // https://www.w3.org/TR/WCAG/#contrast-enhanced
62314
+ var contrastRatio = this.contrast(color2);
62315
+ if (contrastRatio >= 7) {
62316
+ return 'AAA';
62317
+ }
62318
+ return contrastRatio >= 4.5 ? 'AA' : '';
62319
+ },
62320
+ isDark: function isDark() {
62321
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
62322
+ var rgb = this.rgb().color;
62323
+ var yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
62324
+ return yiq < 128;
62325
+ },
62326
+ isLight: function isLight() {
62327
+ return !this.isDark();
62328
+ },
62329
+ negate: function negate() {
62330
+ var rgb = this.rgb();
62331
+ for (var i = 0; i < 3; i++) {
62332
+ rgb.color[i] = 255 - rgb.color[i];
62333
+ }
62334
+ return rgb;
62335
+ },
62336
+ lighten: function lighten(ratio) {
62337
+ var hsl = this.hsl();
62338
+ hsl.color[2] += hsl.color[2] * ratio;
62339
+ return hsl;
62340
+ },
62341
+ darken: function darken(ratio) {
62342
+ var hsl = this.hsl();
62343
+ hsl.color[2] -= hsl.color[2] * ratio;
62344
+ return hsl;
62345
+ },
62346
+ saturate: function saturate(ratio) {
62347
+ var hsl = this.hsl();
62348
+ hsl.color[1] += hsl.color[1] * ratio;
62349
+ return hsl;
62350
+ },
62351
+ desaturate: function desaturate(ratio) {
62352
+ var hsl = this.hsl();
62353
+ hsl.color[1] -= hsl.color[1] * ratio;
62354
+ return hsl;
62355
+ },
62356
+ whiten: function whiten(ratio) {
62357
+ var hwb = this.hwb();
62358
+ hwb.color[1] += hwb.color[1] * ratio;
62359
+ return hwb;
62360
+ },
62361
+ blacken: function blacken(ratio) {
62362
+ var hwb = this.hwb();
62363
+ hwb.color[2] += hwb.color[2] * ratio;
62364
+ return hwb;
62365
+ },
62366
+ grayscale: function grayscale() {
62367
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
62368
+ var rgb = this.rgb().color;
62369
+ var value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
62370
+ return Color.rgb(value, value, value);
62371
+ },
62372
+ fade: function fade(ratio) {
62373
+ return this.alpha(this.valpha - this.valpha * ratio);
62374
+ },
62375
+ opaquer: function opaquer(ratio) {
62376
+ return this.alpha(this.valpha + this.valpha * ratio);
62377
+ },
62378
+ rotate: function rotate(degrees) {
62379
+ var hsl = this.hsl();
62380
+ var hue = hsl.color[0];
62381
+ hue = (hue + degrees) % 360;
62382
+ hue = hue < 0 ? 360 + hue : hue;
62383
+ hsl.color[0] = hue;
62384
+ return hsl;
62385
+ },
62386
+ mix: function mix(mixinColor, weight) {
62387
+ // Ported from sass implementation in C
62388
+ // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
62389
+ if (!mixinColor || !mixinColor.rgb) {
62390
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + _typeof(mixinColor));
62391
+ }
62392
+ var color1 = mixinColor.rgb();
62393
+ var color2 = this.rgb();
62394
+ var p = weight === undefined ? 0.5 : weight;
62395
+ var w = 2 * p - 1;
62396
+ var a = color1.alpha() - color2.alpha();
62397
+ var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
62398
+ var w2 = 1 - w1;
62399
+ return Color.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p));
62458
62400
  }
62459
- return [hwb[0], c * 100, g * 100];
62460
- };
62461
- convert.apple.rgb = function (apple) {
62462
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
62463
- };
62464
- convert.rgb.apple = function (rgb) {
62465
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
62466
- };
62467
- convert.gray.rgb = function (args) {
62468
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
62469
- };
62470
- convert.gray.hsl = convert.gray.hsv = function (args) {
62471
- return [0, 0, args[0]];
62472
- };
62473
- convert.gray.hwb = function (gray) {
62474
- return [0, 100, gray[0]];
62475
- };
62476
- convert.gray.cmyk = function (gray) {
62477
- return [0, 0, 0, gray[0]];
62478
- };
62479
- convert.gray.lab = function (gray) {
62480
- return [gray[0], 0, 0];
62481
- };
62482
- convert.gray.hex = function (gray) {
62483
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
62484
- var integer = (val << 16) + (val << 8) + val;
62485
- var string = integer.toString(16).toUpperCase();
62486
- return '000000'.substring(string.length) + string;
62487
- };
62488
- convert.rgb.gray = function (rgb) {
62489
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
62490
- return [val / 255 * 100];
62491
62401
  };
62492
62402
 
62493
- /***/ }),
62494
-
62495
- /***/ "./node_modules/color-convert/index.js":
62496
- /*!*********************************************!*\
62497
- !*** ./node_modules/color-convert/index.js ***!
62498
- \*********************************************/
62499
- /*! no static exports found */
62500
- /***/ (function(module, exports, __webpack_require__) {
62403
+ // Model conversion methods and static constructors
62404
+ var _loop = function _loop() {
62405
+ var model = _Object$keys2[_i2];
62406
+ if (skippedModels.includes(model)) {
62407
+ return "continue";
62408
+ }
62409
+ var channels = convert[model].channels;
62501
62410
 
62502
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
62503
- var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
62504
- var route = __webpack_require__(/*! ./route */ "./node_modules/color-convert/route.js");
62505
- var convert = {};
62506
- var models = Object.keys(conversions);
62507
- function wrapRaw(fn) {
62508
- var wrappedFn = function wrappedFn(args) {
62509
- if (args === undefined || args === null) {
62510
- return args;
62411
+ // Conversion methods
62412
+ Color.prototype[model] = function () {
62413
+ if (this.model === model) {
62414
+ return new Color(this);
62511
62415
  }
62512
- if (arguments.length > 1) {
62513
- args = Array.prototype.slice.call(arguments);
62416
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
62417
+ args[_key] = arguments[_key];
62514
62418
  }
62515
- return fn(args);
62419
+ if (args.length > 0) {
62420
+ return new Color(args, model);
62421
+ }
62422
+ return new Color([].concat(_toConsumableArray(assertArray(convert[this.model][model].raw(this.color))), [this.valpha]), model);
62516
62423
  };
62517
62424
 
62518
- // preserve .conversion property if there is one
62519
- if ('conversion' in fn) {
62520
- wrappedFn.conversion = fn.conversion;
62521
- }
62522
- return wrappedFn;
62523
- }
62524
- function wrapRounded(fn) {
62525
- var wrappedFn = function wrappedFn(args) {
62526
- if (args === undefined || args === null) {
62527
- return args;
62425
+ // 'static' construction methods
62426
+ Color[model] = function () {
62427
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
62428
+ args[_key2] = arguments[_key2];
62528
62429
  }
62529
- if (arguments.length > 1) {
62530
- args = Array.prototype.slice.call(arguments);
62430
+ var color = args[0];
62431
+ if (typeof color === 'number') {
62432
+ color = zeroArray(args, channels);
62531
62433
  }
62532
- var result = fn(args);
62533
-
62534
- // we're assuming the result is an array here.
62535
- // see notice in conversions.js; don't use box types
62536
- // in conversion functions.
62537
- if (_typeof(result) === 'object') {
62538
- for (var len = result.length, i = 0; i < len; i++) {
62539
- result[i] = Math.round(result[i]);
62434
+ return new Color(color, model);
62435
+ };
62436
+ };
62437
+ for (var _i2 = 0, _Object$keys2 = Object.keys(convert); _i2 < _Object$keys2.length; _i2++) {
62438
+ var _ret = _loop();
62439
+ if (_ret === "continue") continue;
62440
+ }
62441
+ function roundTo(number, places) {
62442
+ return Number(number.toFixed(places));
62443
+ }
62444
+ function roundToPlace(places) {
62445
+ return function (number) {
62446
+ return roundTo(number, places);
62447
+ };
62448
+ }
62449
+ function getset(model, channel, modifier) {
62450
+ model = Array.isArray(model) ? model : [model];
62451
+ var _iterator2 = _createForOfIteratorHelper(model),
62452
+ _step2;
62453
+ try {
62454
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
62455
+ var m = _step2.value;
62456
+ (limiters[m] || (limiters[m] = []))[channel] = modifier;
62457
+ }
62458
+ } catch (err) {
62459
+ _iterator2.e(err);
62460
+ } finally {
62461
+ _iterator2.f();
62462
+ }
62463
+ model = model[0];
62464
+ return function (value) {
62465
+ var result;
62466
+ if (value !== undefined) {
62467
+ if (modifier) {
62468
+ value = modifier(value);
62540
62469
  }
62470
+ result = this[model]();
62471
+ result.color[channel] = value;
62472
+ return result;
62473
+ }
62474
+ result = this[model]().color[channel];
62475
+ if (modifier) {
62476
+ result = modifier(result);
62541
62477
  }
62542
62478
  return result;
62543
62479
  };
62544
-
62545
- // preserve .conversion property if there is one
62546
- if ('conversion' in fn) {
62547
- wrappedFn.conversion = fn.conversion;
62548
- }
62549
- return wrappedFn;
62550
62480
  }
62551
- models.forEach(function (fromModel) {
62552
- convert[fromModel] = {};
62553
- Object.defineProperty(convert[fromModel], 'channels', {
62554
- value: conversions[fromModel].channels
62555
- });
62556
- Object.defineProperty(convert[fromModel], 'labels', {
62557
- value: conversions[fromModel].labels
62558
- });
62559
- var routes = route(fromModel);
62560
- var routeModels = Object.keys(routes);
62561
- routeModels.forEach(function (toModel) {
62562
- var fn = routes[toModel];
62563
- convert[fromModel][toModel] = wrapRounded(fn);
62564
- convert[fromModel][toModel].raw = wrapRaw(fn);
62565
- });
62566
- });
62567
- module.exports = convert;
62568
-
62569
- /***/ }),
62570
-
62571
- /***/ "./node_modules/color-convert/node_modules/color-name/index.js":
62572
- /*!*********************************************************************!*\
62573
- !*** ./node_modules/color-convert/node_modules/color-name/index.js ***!
62574
- \*********************************************************************/
62575
- /*! no static exports found */
62576
- /***/ (function(module, exports, __webpack_require__) {
62577
-
62578
- "use strict";
62579
-
62580
-
62581
- module.exports = {
62582
- "aliceblue": [240, 248, 255],
62583
- "antiquewhite": [250, 235, 215],
62584
- "aqua": [0, 255, 255],
62585
- "aquamarine": [127, 255, 212],
62586
- "azure": [240, 255, 255],
62587
- "beige": [245, 245, 220],
62588
- "bisque": [255, 228, 196],
62589
- "black": [0, 0, 0],
62590
- "blanchedalmond": [255, 235, 205],
62591
- "blue": [0, 0, 255],
62592
- "blueviolet": [138, 43, 226],
62593
- "brown": [165, 42, 42],
62594
- "burlywood": [222, 184, 135],
62595
- "cadetblue": [95, 158, 160],
62596
- "chartreuse": [127, 255, 0],
62597
- "chocolate": [210, 105, 30],
62598
- "coral": [255, 127, 80],
62599
- "cornflowerblue": [100, 149, 237],
62600
- "cornsilk": [255, 248, 220],
62601
- "crimson": [220, 20, 60],
62602
- "cyan": [0, 255, 255],
62603
- "darkblue": [0, 0, 139],
62604
- "darkcyan": [0, 139, 139],
62605
- "darkgoldenrod": [184, 134, 11],
62606
- "darkgray": [169, 169, 169],
62607
- "darkgreen": [0, 100, 0],
62608
- "darkgrey": [169, 169, 169],
62609
- "darkkhaki": [189, 183, 107],
62610
- "darkmagenta": [139, 0, 139],
62611
- "darkolivegreen": [85, 107, 47],
62612
- "darkorange": [255, 140, 0],
62613
- "darkorchid": [153, 50, 204],
62614
- "darkred": [139, 0, 0],
62615
- "darksalmon": [233, 150, 122],
62616
- "darkseagreen": [143, 188, 143],
62617
- "darkslateblue": [72, 61, 139],
62618
- "darkslategray": [47, 79, 79],
62619
- "darkslategrey": [47, 79, 79],
62620
- "darkturquoise": [0, 206, 209],
62621
- "darkviolet": [148, 0, 211],
62622
- "deeppink": [255, 20, 147],
62623
- "deepskyblue": [0, 191, 255],
62624
- "dimgray": [105, 105, 105],
62625
- "dimgrey": [105, 105, 105],
62626
- "dodgerblue": [30, 144, 255],
62627
- "firebrick": [178, 34, 34],
62628
- "floralwhite": [255, 250, 240],
62629
- "forestgreen": [34, 139, 34],
62630
- "fuchsia": [255, 0, 255],
62631
- "gainsboro": [220, 220, 220],
62632
- "ghostwhite": [248, 248, 255],
62633
- "gold": [255, 215, 0],
62634
- "goldenrod": [218, 165, 32],
62635
- "gray": [128, 128, 128],
62636
- "green": [0, 128, 0],
62637
- "greenyellow": [173, 255, 47],
62638
- "grey": [128, 128, 128],
62639
- "honeydew": [240, 255, 240],
62640
- "hotpink": [255, 105, 180],
62641
- "indianred": [205, 92, 92],
62642
- "indigo": [75, 0, 130],
62643
- "ivory": [255, 255, 240],
62644
- "khaki": [240, 230, 140],
62645
- "lavender": [230, 230, 250],
62646
- "lavenderblush": [255, 240, 245],
62647
- "lawngreen": [124, 252, 0],
62648
- "lemonchiffon": [255, 250, 205],
62649
- "lightblue": [173, 216, 230],
62650
- "lightcoral": [240, 128, 128],
62651
- "lightcyan": [224, 255, 255],
62652
- "lightgoldenrodyellow": [250, 250, 210],
62653
- "lightgray": [211, 211, 211],
62654
- "lightgreen": [144, 238, 144],
62655
- "lightgrey": [211, 211, 211],
62656
- "lightpink": [255, 182, 193],
62657
- "lightsalmon": [255, 160, 122],
62658
- "lightseagreen": [32, 178, 170],
62659
- "lightskyblue": [135, 206, 250],
62660
- "lightslategray": [119, 136, 153],
62661
- "lightslategrey": [119, 136, 153],
62662
- "lightsteelblue": [176, 196, 222],
62663
- "lightyellow": [255, 255, 224],
62664
- "lime": [0, 255, 0],
62665
- "limegreen": [50, 205, 50],
62666
- "linen": [250, 240, 230],
62667
- "magenta": [255, 0, 255],
62668
- "maroon": [128, 0, 0],
62669
- "mediumaquamarine": [102, 205, 170],
62670
- "mediumblue": [0, 0, 205],
62671
- "mediumorchid": [186, 85, 211],
62672
- "mediumpurple": [147, 112, 219],
62673
- "mediumseagreen": [60, 179, 113],
62674
- "mediumslateblue": [123, 104, 238],
62675
- "mediumspringgreen": [0, 250, 154],
62676
- "mediumturquoise": [72, 209, 204],
62677
- "mediumvioletred": [199, 21, 133],
62678
- "midnightblue": [25, 25, 112],
62679
- "mintcream": [245, 255, 250],
62680
- "mistyrose": [255, 228, 225],
62681
- "moccasin": [255, 228, 181],
62682
- "navajowhite": [255, 222, 173],
62683
- "navy": [0, 0, 128],
62684
- "oldlace": [253, 245, 230],
62685
- "olive": [128, 128, 0],
62686
- "olivedrab": [107, 142, 35],
62687
- "orange": [255, 165, 0],
62688
- "orangered": [255, 69, 0],
62689
- "orchid": [218, 112, 214],
62690
- "palegoldenrod": [238, 232, 170],
62691
- "palegreen": [152, 251, 152],
62692
- "paleturquoise": [175, 238, 238],
62693
- "palevioletred": [219, 112, 147],
62694
- "papayawhip": [255, 239, 213],
62695
- "peachpuff": [255, 218, 185],
62696
- "peru": [205, 133, 63],
62697
- "pink": [255, 192, 203],
62698
- "plum": [221, 160, 221],
62699
- "powderblue": [176, 224, 230],
62700
- "purple": [128, 0, 128],
62701
- "rebeccapurple": [102, 51, 153],
62702
- "red": [255, 0, 0],
62703
- "rosybrown": [188, 143, 143],
62704
- "royalblue": [65, 105, 225],
62705
- "saddlebrown": [139, 69, 19],
62706
- "salmon": [250, 128, 114],
62707
- "sandybrown": [244, 164, 96],
62708
- "seagreen": [46, 139, 87],
62709
- "seashell": [255, 245, 238],
62710
- "sienna": [160, 82, 45],
62711
- "silver": [192, 192, 192],
62712
- "skyblue": [135, 206, 235],
62713
- "slateblue": [106, 90, 205],
62714
- "slategray": [112, 128, 144],
62715
- "slategrey": [112, 128, 144],
62716
- "snow": [255, 250, 250],
62717
- "springgreen": [0, 255, 127],
62718
- "steelblue": [70, 130, 180],
62719
- "tan": [210, 180, 140],
62720
- "teal": [0, 128, 128],
62721
- "thistle": [216, 191, 216],
62722
- "tomato": [255, 99, 71],
62723
- "turquoise": [64, 224, 208],
62724
- "violet": [238, 130, 238],
62725
- "wheat": [245, 222, 179],
62726
- "white": [255, 255, 255],
62727
- "whitesmoke": [245, 245, 245],
62728
- "yellow": [255, 255, 0],
62729
- "yellowgreen": [154, 205, 50]
62730
- };
62481
+ function maxfn(max) {
62482
+ return function (v) {
62483
+ return Math.max(0, Math.min(max, v));
62484
+ };
62485
+ }
62486
+ function assertArray(value) {
62487
+ return Array.isArray(value) ? value : [value];
62488
+ }
62489
+ function zeroArray(array, length) {
62490
+ for (var i = 0; i < length; i++) {
62491
+ if (typeof array[i] !== 'number') {
62492
+ array[i] = 0;
62493
+ }
62494
+ }
62495
+ return array;
62496
+ }
62497
+ module.exports = Color;
62731
62498
 
62732
62499
  /***/ }),
62733
62500
 
62734
- /***/ "./node_modules/color-convert/route.js":
62735
- /*!*********************************************!*\
62736
- !*** ./node_modules/color-convert/route.js ***!
62737
- \*********************************************/
62501
+ /***/ "./node_modules/color/node_modules/color-convert/conversions.js":
62502
+ /*!**********************************************************************!*\
62503
+ !*** ./node_modules/color/node_modules/color-convert/conversions.js ***!
62504
+ \**********************************************************************/
62738
62505
  /*! no static exports found */
62739
62506
  /***/ (function(module, exports, __webpack_require__) {
62740
62507
 
62741
- var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
62742
-
62743
- /*
62744
- this function routes a model to all other models.
62508
+ var _slicedToArray = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
62509
+ /* MIT license */
62510
+ /* eslint-disable no-mixed-operators */
62511
+ var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
62745
62512
 
62746
- all functions that are routed have a property `.conversion` attached
62747
- to the returned synthetic function. This property is an array
62748
- of strings, each with the steps in between the 'from' and 'to'
62749
- color models (inclusive).
62513
+ // NOTE: conversions should only return primitive values (i.e. arrays, or
62514
+ // values that give correct `typeof` results).
62515
+ // do not use box values types (i.e. Number(), String(), etc.)
62750
62516
 
62751
- conversions that are not possible simply are not included.
62752
- */
62517
+ var reverseKeywords = {};
62518
+ for (var _i = 0, _Object$keys = Object.keys(cssKeywords); _i < _Object$keys.length; _i++) {
62519
+ var key = _Object$keys[_i];
62520
+ reverseKeywords[cssKeywords[key]] = key;
62521
+ }
62522
+ var convert = {
62523
+ rgb: {
62524
+ channels: 3,
62525
+ labels: 'rgb'
62526
+ },
62527
+ hsl: {
62528
+ channels: 3,
62529
+ labels: 'hsl'
62530
+ },
62531
+ hsv: {
62532
+ channels: 3,
62533
+ labels: 'hsv'
62534
+ },
62535
+ hwb: {
62536
+ channels: 3,
62537
+ labels: 'hwb'
62538
+ },
62539
+ cmyk: {
62540
+ channels: 4,
62541
+ labels: 'cmyk'
62542
+ },
62543
+ xyz: {
62544
+ channels: 3,
62545
+ labels: 'xyz'
62546
+ },
62547
+ lab: {
62548
+ channels: 3,
62549
+ labels: 'lab'
62550
+ },
62551
+ lch: {
62552
+ channels: 3,
62553
+ labels: 'lch'
62554
+ },
62555
+ hex: {
62556
+ channels: 1,
62557
+ labels: ['hex']
62558
+ },
62559
+ keyword: {
62560
+ channels: 1,
62561
+ labels: ['keyword']
62562
+ },
62563
+ ansi16: {
62564
+ channels: 1,
62565
+ labels: ['ansi16']
62566
+ },
62567
+ ansi256: {
62568
+ channels: 1,
62569
+ labels: ['ansi256']
62570
+ },
62571
+ hcg: {
62572
+ channels: 3,
62573
+ labels: ['h', 'c', 'g']
62574
+ },
62575
+ apple: {
62576
+ channels: 3,
62577
+ labels: ['r16', 'g16', 'b16']
62578
+ },
62579
+ gray: {
62580
+ channels: 1,
62581
+ labels: ['gray']
62582
+ }
62583
+ };
62584
+ module.exports = convert;
62753
62585
 
62754
- function buildGraph() {
62755
- var graph = {};
62756
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
62757
- var models = Object.keys(conversions);
62758
- for (var len = models.length, i = 0; i < len; i++) {
62759
- graph[models[i]] = {
62760
- // http://jsperf.com/1-vs-infinity
62761
- // micro-opt, but this is simple.
62762
- distance: -1,
62763
- parent: null
62764
- };
62586
+ // Hide .channels and .labels properties
62587
+ for (var _i2 = 0, _Object$keys2 = Object.keys(convert); _i2 < _Object$keys2.length; _i2++) {
62588
+ var model = _Object$keys2[_i2];
62589
+ if (!('channels' in convert[model])) {
62590
+ throw new Error('missing channels property: ' + model);
62591
+ }
62592
+ if (!('labels' in convert[model])) {
62593
+ throw new Error('missing channel labels property: ' + model);
62594
+ }
62595
+ if (convert[model].labels.length !== convert[model].channels) {
62596
+ throw new Error('channel and label counts mismatch: ' + model);
62597
+ }
62598
+ var _convert$model = convert[model],
62599
+ channels = _convert$model.channels,
62600
+ labels = _convert$model.labels;
62601
+ delete convert[model].channels;
62602
+ delete convert[model].labels;
62603
+ Object.defineProperty(convert[model], 'channels', {
62604
+ value: channels
62605
+ });
62606
+ Object.defineProperty(convert[model], 'labels', {
62607
+ value: labels
62608
+ });
62609
+ }
62610
+ convert.rgb.hsl = function (rgb) {
62611
+ var r = rgb[0] / 255;
62612
+ var g = rgb[1] / 255;
62613
+ var b = rgb[2] / 255;
62614
+ var min = Math.min(r, g, b);
62615
+ var max = Math.max(r, g, b);
62616
+ var delta = max - min;
62617
+ var h;
62618
+ var s;
62619
+ if (max === min) {
62620
+ h = 0;
62621
+ } else if (r === max) {
62622
+ h = (g - b) / delta;
62623
+ } else if (g === max) {
62624
+ h = 2 + (b - r) / delta;
62625
+ } else if (b === max) {
62626
+ h = 4 + (r - g) / delta;
62765
62627
  }
62766
- return graph;
62628
+ h = Math.min(h * 60, 360);
62629
+ if (h < 0) {
62630
+ h += 360;
62631
+ }
62632
+ var l = (min + max) / 2;
62633
+ if (max === min) {
62634
+ s = 0;
62635
+ } else if (l <= 0.5) {
62636
+ s = delta / (max + min);
62637
+ } else {
62638
+ s = delta / (2 - max - min);
62639
+ }
62640
+ return [h, s * 100, l * 100];
62641
+ };
62642
+ convert.rgb.hsv = function (rgb) {
62643
+ var rdif;
62644
+ var gdif;
62645
+ var bdif;
62646
+ var h;
62647
+ var s;
62648
+ var r = rgb[0] / 255;
62649
+ var g = rgb[1] / 255;
62650
+ var b = rgb[2] / 255;
62651
+ var v = Math.max(r, g, b);
62652
+ var diff = v - Math.min(r, g, b);
62653
+ var diffc = function diffc(c) {
62654
+ return (v - c) / 6 / diff + 1 / 2;
62655
+ };
62656
+ if (diff === 0) {
62657
+ h = 0;
62658
+ s = 0;
62659
+ } else {
62660
+ s = diff / v;
62661
+ rdif = diffc(r);
62662
+ gdif = diffc(g);
62663
+ bdif = diffc(b);
62664
+ if (r === v) {
62665
+ h = bdif - gdif;
62666
+ } else if (g === v) {
62667
+ h = 1 / 3 + rdif - bdif;
62668
+ } else if (b === v) {
62669
+ h = 2 / 3 + gdif - rdif;
62670
+ }
62671
+ if (h < 0) {
62672
+ h += 1;
62673
+ } else if (h > 1) {
62674
+ h -= 1;
62675
+ }
62676
+ }
62677
+ return [h * 360, s * 100, v * 100];
62678
+ };
62679
+ convert.rgb.hwb = function (rgb) {
62680
+ var r = rgb[0];
62681
+ var g = rgb[1];
62682
+ var b = rgb[2];
62683
+ var h = convert.rgb.hsl(rgb)[0];
62684
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
62685
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
62686
+ return [h, w * 100, b * 100];
62687
+ };
62688
+ convert.rgb.cmyk = function (rgb) {
62689
+ var r = rgb[0] / 255;
62690
+ var g = rgb[1] / 255;
62691
+ var b = rgb[2] / 255;
62692
+ var k = Math.min(1 - r, 1 - g, 1 - b);
62693
+ var c = (1 - r - k) / (1 - k) || 0;
62694
+ var m = (1 - g - k) / (1 - k) || 0;
62695
+ var y = (1 - b - k) / (1 - k) || 0;
62696
+ return [c * 100, m * 100, y * 100, k * 100];
62697
+ };
62698
+ function comparativeDistance(x, y) {
62699
+ /*
62700
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
62701
+ */
62702
+ return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
62767
62703
  }
62704
+ convert.rgb.keyword = function (rgb) {
62705
+ var reversed = reverseKeywords[rgb];
62706
+ if (reversed) {
62707
+ return reversed;
62708
+ }
62709
+ var currentClosestDistance = Infinity;
62710
+ var currentClosestKeyword;
62711
+ for (var _i3 = 0, _Object$keys3 = Object.keys(cssKeywords); _i3 < _Object$keys3.length; _i3++) {
62712
+ var keyword = _Object$keys3[_i3];
62713
+ var value = cssKeywords[keyword];
62768
62714
 
62769
- // https://en.wikipedia.org/wiki/Breadth-first_search
62770
- function deriveBFS(fromModel) {
62771
- var graph = buildGraph();
62772
- var queue = [fromModel]; // unshift -> queue -> pop
62715
+ // Compute comparative distance
62716
+ var distance = comparativeDistance(rgb, value);
62773
62717
 
62774
- graph[fromModel].distance = 0;
62775
- while (queue.length) {
62776
- var current = queue.pop();
62777
- var adjacents = Object.keys(conversions[current]);
62778
- for (var len = adjacents.length, i = 0; i < len; i++) {
62779
- var adjacent = adjacents[i];
62780
- var node = graph[adjacent];
62781
- if (node.distance === -1) {
62782
- node.distance = graph[current].distance + 1;
62783
- node.parent = current;
62784
- queue.unshift(adjacent);
62785
- }
62718
+ // Check if its less, if so set as closest
62719
+ if (distance < currentClosestDistance) {
62720
+ currentClosestDistance = distance;
62721
+ currentClosestKeyword = keyword;
62786
62722
  }
62787
62723
  }
62788
- return graph;
62789
- }
62790
- function link(from, to) {
62791
- return function (args) {
62792
- return to(from(args));
62793
- };
62794
- }
62795
- function wrapConversion(toModel, graph) {
62796
- var path = [graph[toModel].parent, toModel];
62797
- var fn = conversions[graph[toModel].parent][toModel];
62798
- var cur = graph[toModel].parent;
62799
- while (graph[cur].parent) {
62800
- path.unshift(graph[cur].parent);
62801
- fn = link(conversions[graph[cur].parent][cur], fn);
62802
- cur = graph[cur].parent;
62724
+ return currentClosestKeyword;
62725
+ };
62726
+ convert.keyword.rgb = function (keyword) {
62727
+ return cssKeywords[keyword];
62728
+ };
62729
+ convert.rgb.xyz = function (rgb) {
62730
+ var r = rgb[0] / 255;
62731
+ var g = rgb[1] / 255;
62732
+ var b = rgb[2] / 255;
62733
+
62734
+ // Assume sRGB
62735
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
62736
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
62737
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
62738
+ var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
62739
+ var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
62740
+ var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
62741
+ return [x * 100, y * 100, z * 100];
62742
+ };
62743
+ convert.rgb.lab = function (rgb) {
62744
+ var xyz = convert.rgb.xyz(rgb);
62745
+ var x = xyz[0];
62746
+ var y = xyz[1];
62747
+ var z = xyz[2];
62748
+ x /= 95.047;
62749
+ y /= 100;
62750
+ z /= 108.883;
62751
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
62752
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
62753
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
62754
+ var l = 116 * y - 16;
62755
+ var a = 500 * (x - y);
62756
+ var b = 200 * (y - z);
62757
+ return [l, a, b];
62758
+ };
62759
+ convert.hsl.rgb = function (hsl) {
62760
+ var h = hsl[0] / 360;
62761
+ var s = hsl[1] / 100;
62762
+ var l = hsl[2] / 100;
62763
+ var t2;
62764
+ var t3;
62765
+ var val;
62766
+ if (s === 0) {
62767
+ val = l * 255;
62768
+ return [val, val, val];
62803
62769
  }
62804
- fn.conversion = path;
62805
- return fn;
62806
- }
62807
- module.exports = function (fromModel) {
62808
- var graph = deriveBFS(fromModel);
62809
- var conversion = {};
62810
- var models = Object.keys(graph);
62811
- for (var len = models.length, i = 0; i < len; i++) {
62812
- var toModel = models[i];
62813
- var node = graph[toModel];
62814
- if (node.parent === null) {
62815
- // no possible conversion, or this node is the source model.
62816
- continue;
62770
+ if (l < 0.5) {
62771
+ t2 = l * (1 + s);
62772
+ } else {
62773
+ t2 = l + s - l * s;
62774
+ }
62775
+ var t1 = 2 * l - t2;
62776
+ var rgb = [0, 0, 0];
62777
+ for (var i = 0; i < 3; i++) {
62778
+ t3 = h + 1 / 3 * -(i - 1);
62779
+ if (t3 < 0) {
62780
+ t3++;
62817
62781
  }
62818
- conversion[toModel] = wrapConversion(toModel, graph);
62782
+ if (t3 > 1) {
62783
+ t3--;
62784
+ }
62785
+ if (6 * t3 < 1) {
62786
+ val = t1 + (t2 - t1) * 6 * t3;
62787
+ } else if (2 * t3 < 1) {
62788
+ val = t2;
62789
+ } else if (3 * t3 < 2) {
62790
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
62791
+ } else {
62792
+ val = t1;
62793
+ }
62794
+ rgb[i] = val * 255;
62819
62795
  }
62820
- return conversion;
62796
+ return rgb;
62797
+ };
62798
+ convert.hsl.hsv = function (hsl) {
62799
+ var h = hsl[0];
62800
+ var s = hsl[1] / 100;
62801
+ var l = hsl[2] / 100;
62802
+ var smin = s;
62803
+ var lmin = Math.max(l, 0.01);
62804
+ l *= 2;
62805
+ s *= l <= 1 ? l : 2 - l;
62806
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
62807
+ var v = (l + s) / 2;
62808
+ var sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
62809
+ return [h, sv * 100, v * 100];
62810
+ };
62811
+ convert.hsv.rgb = function (hsv) {
62812
+ var h = hsv[0] / 60;
62813
+ var s = hsv[1] / 100;
62814
+ var v = hsv[2] / 100;
62815
+ var hi = Math.floor(h) % 6;
62816
+ var f = h - Math.floor(h);
62817
+ var p = 255 * v * (1 - s);
62818
+ var q = 255 * v * (1 - s * f);
62819
+ var t = 255 * v * (1 - s * (1 - f));
62820
+ v *= 255;
62821
+ switch (hi) {
62822
+ case 0:
62823
+ return [v, t, p];
62824
+ case 1:
62825
+ return [q, v, p];
62826
+ case 2:
62827
+ return [p, v, t];
62828
+ case 3:
62829
+ return [p, q, v];
62830
+ case 4:
62831
+ return [t, p, v];
62832
+ case 5:
62833
+ return [v, p, q];
62834
+ }
62835
+ };
62836
+ convert.hsv.hsl = function (hsv) {
62837
+ var h = hsv[0];
62838
+ var s = hsv[1] / 100;
62839
+ var v = hsv[2] / 100;
62840
+ var vmin = Math.max(v, 0.01);
62841
+ var sl;
62842
+ var l;
62843
+ l = (2 - s) * v;
62844
+ var lmin = (2 - s) * vmin;
62845
+ sl = s * vmin;
62846
+ sl /= lmin <= 1 ? lmin : 2 - lmin;
62847
+ sl = sl || 0;
62848
+ l /= 2;
62849
+ return [h, sl * 100, l * 100];
62821
62850
  };
62822
62851
 
62823
- /***/ }),
62852
+ // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
62853
+ convert.hwb.rgb = function (hwb) {
62854
+ var h = hwb[0] / 360;
62855
+ var wh = hwb[1] / 100;
62856
+ var bl = hwb[2] / 100;
62857
+ var ratio = wh + bl;
62858
+ var f;
62824
62859
 
62825
- /***/ "./node_modules/color-ie/lib/index.js":
62826
- /*!********************************************!*\
62827
- !*** ./node_modules/color-ie/lib/index.js ***!
62828
- \********************************************/
62829
- /*! no static exports found */
62830
- /***/ (function(module, exports, __webpack_require__) {
62860
+ // Wh + bl cant be > 1
62861
+ if (ratio > 1) {
62862
+ wh /= ratio;
62863
+ bl /= ratio;
62864
+ }
62865
+ var i = Math.floor(6 * h);
62866
+ var v = 1 - bl;
62867
+ f = 6 * h - i;
62868
+ if ((i & 0x01) !== 0) {
62869
+ f = 1 - f;
62870
+ }
62871
+ var n = wh + f * (v - wh); // Linear interpolation
62831
62872
 
62832
- "use strict";
62873
+ var r;
62874
+ var g;
62875
+ var b;
62876
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
62877
+ switch (i) {
62878
+ default:
62879
+ case 6:
62880
+ case 0:
62881
+ r = v;
62882
+ g = n;
62883
+ b = wh;
62884
+ break;
62885
+ case 1:
62886
+ r = n;
62887
+ g = v;
62888
+ b = wh;
62889
+ break;
62890
+ case 2:
62891
+ r = wh;
62892
+ g = v;
62893
+ b = n;
62894
+ break;
62895
+ case 3:
62896
+ r = wh;
62897
+ g = n;
62898
+ b = v;
62899
+ break;
62900
+ case 4:
62901
+ r = n;
62902
+ g = wh;
62903
+ b = v;
62904
+ break;
62905
+ case 5:
62906
+ r = v;
62907
+ g = wh;
62908
+ b = n;
62909
+ break;
62910
+ }
62911
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
62833
62912
 
62913
+ return [r * 255, g * 255, b * 255];
62914
+ };
62915
+ convert.cmyk.rgb = function (cmyk) {
62916
+ var c = cmyk[0] / 100;
62917
+ var m = cmyk[1] / 100;
62918
+ var y = cmyk[2] / 100;
62919
+ var k = cmyk[3] / 100;
62920
+ var r = 1 - Math.min(1, c * (1 - k) + k);
62921
+ var g = 1 - Math.min(1, m * (1 - k) + k);
62922
+ var b = 1 - Math.min(1, y * (1 - k) + k);
62923
+ return [r * 255, g * 255, b * 255];
62924
+ };
62925
+ convert.xyz.rgb = function (xyz) {
62926
+ var x = xyz[0] / 100;
62927
+ var y = xyz[1] / 100;
62928
+ var z = xyz[2] / 100;
62929
+ var r;
62930
+ var g;
62931
+ var b;
62932
+ r = x * 3.2406 + y * -1.5372 + z * -0.4986;
62933
+ g = x * -0.9689 + y * 1.8758 + z * 0.0415;
62934
+ b = x * 0.0557 + y * -0.2040 + z * 1.0570;
62834
62935
 
62835
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
62836
- function _array_like_to_array(arr, len) {
62837
- if (len == null || len > arr.length) len = arr.length;
62838
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
62839
- return arr2;
62840
- }
62841
- function _array_with_holes(arr) {
62842
- if (Array.isArray(arr)) return arr;
62843
- }
62844
- function _array_without_holes(arr) {
62845
- if (Array.isArray(arr)) return _array_like_to_array(arr);
62846
- }
62847
- function _instanceof(left, right) {
62848
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
62849
- return !!right[Symbol.hasInstance](left);
62850
- } else {
62851
- return left instanceof right;
62936
+ // Assume sRGB
62937
+ r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
62938
+ g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
62939
+ b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
62940
+ r = Math.min(Math.max(0, r), 1);
62941
+ g = Math.min(Math.max(0, g), 1);
62942
+ b = Math.min(Math.max(0, b), 1);
62943
+ return [r * 255, g * 255, b * 255];
62944
+ };
62945
+ convert.xyz.lab = function (xyz) {
62946
+ var x = xyz[0];
62947
+ var y = xyz[1];
62948
+ var z = xyz[2];
62949
+ x /= 95.047;
62950
+ y /= 100;
62951
+ z /= 108.883;
62952
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
62953
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
62954
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
62955
+ var l = 116 * y - 16;
62956
+ var a = 500 * (x - y);
62957
+ var b = 200 * (y - z);
62958
+ return [l, a, b];
62959
+ };
62960
+ convert.lab.xyz = function (lab) {
62961
+ var l = lab[0];
62962
+ var a = lab[1];
62963
+ var b = lab[2];
62964
+ var x;
62965
+ var y;
62966
+ var z;
62967
+ y = (l + 16) / 116;
62968
+ x = a / 500 + y;
62969
+ z = y - b / 200;
62970
+ var y2 = Math.pow(y, 3);
62971
+ var x2 = Math.pow(x, 3);
62972
+ var z2 = Math.pow(z, 3);
62973
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
62974
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
62975
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
62976
+ x *= 95.047;
62977
+ y *= 100;
62978
+ z *= 108.883;
62979
+ return [x, y, z];
62980
+ };
62981
+ convert.lab.lch = function (lab) {
62982
+ var l = lab[0];
62983
+ var a = lab[1];
62984
+ var b = lab[2];
62985
+ var h;
62986
+ var hr = Math.atan2(b, a);
62987
+ h = hr * 360 / 2 / Math.PI;
62988
+ if (h < 0) {
62989
+ h += 360;
62990
+ }
62991
+ var c = Math.sqrt(a * a + b * b);
62992
+ return [l, c, h];
62993
+ };
62994
+ convert.lch.lab = function (lch) {
62995
+ var l = lch[0];
62996
+ var c = lch[1];
62997
+ var h = lch[2];
62998
+ var hr = h / 360 * 2 * Math.PI;
62999
+ var a = c * Math.cos(hr);
63000
+ var b = c * Math.sin(hr);
63001
+ return [l, a, b];
63002
+ };
63003
+ convert.rgb.ansi16 = function (args) {
63004
+ var saturation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
63005
+ var _args = _slicedToArray(args, 3),
63006
+ r = _args[0],
63007
+ g = _args[1],
63008
+ b = _args[2];
63009
+ var value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
63010
+
63011
+ value = Math.round(value / 50);
63012
+ if (value === 0) {
63013
+ return 30;
63014
+ }
63015
+ var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
63016
+ if (value === 2) {
63017
+ ansi += 60;
62852
63018
  }
62853
- }
62854
- function _iterable_to_array(iter) {
62855
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
62856
- }
62857
- function _iterable_to_array_limit(arr, i) {
62858
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
62859
- if (_i == null) return;
62860
- var _arr = [];
62861
- var _n = true;
62862
- var _d = false;
62863
- var _s, _e;
62864
- try {
62865
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
62866
- _arr.push(_s.value);
62867
- if (i && _arr.length === i) break;
63019
+ return ansi;
63020
+ };
63021
+ convert.hsv.ansi16 = function (args) {
63022
+ // Optimization here; we already know the value and don't need to get
63023
+ // it converted for us.
63024
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
63025
+ };
63026
+ convert.rgb.ansi256 = function (args) {
63027
+ var r = args[0];
63028
+ var g = args[1];
63029
+ var b = args[2];
63030
+
63031
+ // We use the extended greyscale palette here, with the exception of
63032
+ // black and white. normal palette only has 4 greyscale shades.
63033
+ if (r === g && g === b) {
63034
+ if (r < 8) {
63035
+ return 16;
62868
63036
  }
62869
- } catch (err) {
62870
- _d = true;
62871
- _e = err;
62872
- } finally {
62873
- try {
62874
- if (!_n && _i["return"] != null) _i["return"]();
62875
- } finally {
62876
- if (_d) throw _e;
63037
+ if (r > 248) {
63038
+ return 231;
62877
63039
  }
63040
+ return Math.round((r - 8) / 247 * 24) + 232;
62878
63041
  }
62879
- return _arr;
62880
- }
62881
- function _non_iterable_rest() {
62882
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62883
- }
62884
- function _non_iterable_spread() {
62885
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62886
- }
62887
- function _sliced_to_array(arr, i) {
62888
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
62889
- }
62890
- function _to_consumable_array(arr) {
62891
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
62892
- }
62893
- function _type_of(obj) {
62894
- "@swc/helpers - typeof";
63042
+ var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
63043
+ return ansi;
63044
+ };
63045
+ convert.ansi16.rgb = function (args) {
63046
+ var color = args % 10;
62895
63047
 
62896
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : _typeof(obj);
62897
- }
62898
- function _unsupported_iterable_to_array(o, minLen) {
62899
- if (!o) return;
62900
- if (typeof o === "string") return _array_like_to_array(o, minLen);
62901
- var n = Object.prototype.toString.call(o).slice(8, -1);
62902
- if (n === "Object" && o.constructor) n = o.constructor.name;
62903
- if (n === "Map" || n === "Set") return Array.from(n);
62904
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
62905
- }
62906
- var colorString = __webpack_require__(/*! color-string */ "./node_modules/color-string/index.js");
62907
- var convert = __webpack_require__(/*! color-convert */ "./node_modules/color-convert/index.js");
62908
- var skippedModels = [
62909
- // To be honest, I don't really feel like keyword belongs in color convert, but eh.
62910
- "keyword",
62911
- // Gray conflicts with some method names, and has its own method defined.
62912
- "gray",
62913
- // Shouldn't really be in color-convert either...
62914
- "hex"];
62915
- var hashedModelKeys = {};
62916
- var _iteratorNormalCompletion = true,
62917
- _didIteratorError = false,
62918
- _iteratorError = undefined;
62919
- try {
62920
- for (var _iterator = Object.keys(convert)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
62921
- var model = _step.value;
62922
- hashedModelKeys[_to_consumable_array(convert[model].labels).sort().join("")] = model;
62923
- }
62924
- } catch (err) {
62925
- _didIteratorError = true;
62926
- _iteratorError = err;
62927
- } finally {
62928
- try {
62929
- if (!_iteratorNormalCompletion && _iterator.return != null) {
62930
- _iterator.return();
62931
- }
62932
- } finally {
62933
- if (_didIteratorError) {
62934
- throw _iteratorError;
63048
+ // Handle greyscale
63049
+ if (color === 0 || color === 7) {
63050
+ if (args > 50) {
63051
+ color += 3.5;
62935
63052
  }
63053
+ color = color / 10.5 * 255;
63054
+ return [color, color, color];
62936
63055
  }
62937
- }
62938
- var limiters = {};
62939
- function Color(object, model) {
62940
- if (!_instanceof(this, Color)) {
62941
- return new Color(object, model);
63056
+ var mult = (~~(args > 50) + 1) * 0.5;
63057
+ var r = (color & 1) * mult * 255;
63058
+ var g = (color >> 1 & 1) * mult * 255;
63059
+ var b = (color >> 2 & 1) * mult * 255;
63060
+ return [r, g, b];
63061
+ };
63062
+ convert.ansi256.rgb = function (args) {
63063
+ // Handle greyscale
63064
+ if (args >= 232) {
63065
+ var c = (args - 232) * 10 + 8;
63066
+ return [c, c, c];
62942
63067
  }
62943
- if (model && model in skippedModels) {
62944
- model = null;
63068
+ args -= 16;
63069
+ var rem;
63070
+ var r = Math.floor(args / 36) / 5 * 255;
63071
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
63072
+ var b = rem % 6 / 5 * 255;
63073
+ return [r, g, b];
63074
+ };
63075
+ convert.rgb.hex = function (args) {
63076
+ var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
63077
+ var string = integer.toString(16).toUpperCase();
63078
+ return '000000'.substring(string.length) + string;
63079
+ };
63080
+ convert.hex.rgb = function (args) {
63081
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
63082
+ if (!match) {
63083
+ return [0, 0, 0];
62945
63084
  }
62946
- if (model && !(model in convert)) {
62947
- throw new Error("Unknown model: " + model);
63085
+ var colorString = match[0];
63086
+ if (match[0].length === 3) {
63087
+ colorString = colorString.split('').map(function (char) {
63088
+ return char + char;
63089
+ }).join('');
62948
63090
  }
62949
- var i;
62950
- var channels;
62951
- if (object == null) {
62952
- this.model = "rgb";
62953
- this.color = [0, 0, 0];
62954
- this.valpha = 1;
62955
- } else if (_instanceof(object, Color)) {
62956
- this.model = object.model;
62957
- this.color = _to_consumable_array(object.color);
62958
- this.valpha = object.valpha;
62959
- } else if (typeof object === "string") {
62960
- var result = colorString.get(object);
62961
- if (result === null) {
62962
- throw new Error("Unable to parse color from string: " + object);
62963
- }
62964
- this.model = result.model;
62965
- channels = convert[this.model].channels;
62966
- this.color = result.value.slice(0, channels);
62967
- this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
62968
- } else if (object.length > 0) {
62969
- this.model = model || "rgb";
62970
- channels = convert[this.model].channels;
62971
- var newArray = Array.prototype.slice.call(object, 0, channels);
62972
- this.color = zeroArray(newArray, channels);
62973
- this.valpha = typeof object[channels] === "number" ? object[channels] : 1;
62974
- } else if (typeof object === "number") {
62975
- // This is always RGB - can be converted later on.
62976
- this.model = "rgb";
62977
- this.color = [object >> 16 & 0xFF, object >> 8 & 0xFF, object & 0xFF];
62978
- this.valpha = 1;
63091
+ var integer = parseInt(colorString, 16);
63092
+ var r = integer >> 16 & 0xFF;
63093
+ var g = integer >> 8 & 0xFF;
63094
+ var b = integer & 0xFF;
63095
+ return [r, g, b];
63096
+ };
63097
+ convert.rgb.hcg = function (rgb) {
63098
+ var r = rgb[0] / 255;
63099
+ var g = rgb[1] / 255;
63100
+ var b = rgb[2] / 255;
63101
+ var max = Math.max(Math.max(r, g), b);
63102
+ var min = Math.min(Math.min(r, g), b);
63103
+ var chroma = max - min;
63104
+ var grayscale;
63105
+ var hue;
63106
+ if (chroma < 1) {
63107
+ grayscale = min / (1 - chroma);
62979
63108
  } else {
62980
- this.valpha = 1;
62981
- var keys = Object.keys(object);
62982
- if ("alpha" in object) {
62983
- keys.splice(keys.indexOf("alpha"), 1);
62984
- this.valpha = typeof object.alpha === "number" ? object.alpha : 0;
62985
- }
62986
- var hashedKeys = keys.sort().join("");
62987
- if (!(hashedKeys in hashedModelKeys)) {
62988
- throw new Error("Unable to parse color from object: " + JSON.stringify(object));
62989
- }
62990
- this.model = hashedModelKeys[hashedKeys];
62991
- var labels = convert[this.model].labels;
62992
- var color = [];
62993
- for (i = 0; i < labels.length; i++) {
62994
- color.push(object[labels[i]]);
62995
- }
62996
- this.color = zeroArray(color);
63109
+ grayscale = 0;
62997
63110
  }
62998
- // Perform limitations (clamping, etc.)
62999
- if (limiters[this.model]) {
63000
- channels = convert[this.model].channels;
63001
- for (i = 0; i < channels; i++) {
63002
- var limit = limiters[this.model][i];
63003
- if (limit) {
63004
- this.color[i] = limit(this.color[i]);
63005
- }
63006
- }
63111
+ if (chroma <= 0) {
63112
+ hue = 0;
63113
+ } else if (max === r) {
63114
+ hue = (g - b) / chroma % 6;
63115
+ } else if (max === g) {
63116
+ hue = 2 + (b - r) / chroma;
63117
+ } else {
63118
+ hue = 4 + (r - g) / chroma;
63007
63119
  }
63008
- this.valpha = Math.max(0, Math.min(1, this.valpha));
63009
- if (Object.freeze) {
63010
- Object.freeze(this);
63120
+ hue /= 6;
63121
+ hue %= 1;
63122
+ return [hue * 360, chroma * 100, grayscale * 100];
63123
+ };
63124
+ convert.hsl.hcg = function (hsl) {
63125
+ var s = hsl[1] / 100;
63126
+ var l = hsl[2] / 100;
63127
+ var c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
63128
+ var f = 0;
63129
+ if (c < 1.0) {
63130
+ f = (l - 0.5 * c) / (1.0 - c);
63011
63131
  }
63012
- }
63013
- Color.prototype = {
63014
- toString: function toString() {
63015
- return this.string();
63016
- },
63017
- toJSON: function toJSON() {
63018
- return this[this.model]();
63019
- },
63020
- string: function string(places) {
63021
- var self = this.model in colorString.to ? this : this.rgb();
63022
- self = self.round(typeof places === "number" ? places : 1);
63023
- var args = self.valpha === 1 ? self.color : _to_consumable_array(self.color).concat([this.valpha]);
63024
- return colorString.to[self.model](args);
63025
- },
63026
- percentString: function percentString(places) {
63027
- var self = this.rgb().round(typeof places === "number" ? places : 1);
63028
- var args = self.valpha === 1 ? self.color : _to_consumable_array(self.color).concat([this.valpha]);
63029
- return colorString.to.rgb.percent(args);
63030
- },
63031
- array: function array() {
63032
- return this.valpha === 1 ? _to_consumable_array(this.color) : _to_consumable_array(this.color).concat([this.valpha]);
63033
- },
63034
- object: function object() {
63035
- var result = {};
63036
- var channels = convert[this.model].channels;
63037
- var labels = convert[this.model].labels;
63038
- for (var i = 0; i < channels; i++) {
63039
- result[labels[i]] = this.color[i];
63040
- }
63041
- if (this.valpha !== 1) {
63042
- result.alpha = this.valpha;
63043
- }
63044
- return result;
63045
- },
63046
- unitArray: function unitArray() {
63047
- var rgb = this.rgb().color;
63048
- rgb[0] /= 255;
63049
- rgb[1] /= 255;
63050
- rgb[2] /= 255;
63051
- if (this.valpha !== 1) {
63052
- rgb.push(this.valpha);
63053
- }
63054
- return rgb;
63055
- },
63056
- unitObject: function unitObject() {
63057
- var rgb = this.rgb().object();
63058
- rgb.r /= 255;
63059
- rgb.g /= 255;
63060
- rgb.b /= 255;
63061
- if (this.valpha !== 1) {
63062
- rgb.alpha = this.valpha;
63063
- }
63064
- return rgb;
63065
- },
63066
- round: function round(places) {
63067
- places = Math.max(places || 0, 0);
63068
- return new Color(_to_consumable_array(this.color.map(roundToPlace(places))).concat([this.valpha]), this.model);
63069
- },
63070
- alpha: function alpha(value) {
63071
- if (value !== undefined) {
63072
- return new Color(_to_consumable_array(this.color).concat([Math.max(0, Math.min(1, value))]), this.model);
63073
- }
63074
- return this.valpha;
63075
- },
63076
- // Rgb
63077
- red: getset("rgb", 0, maxfn(255)),
63078
- green: getset("rgb", 1, maxfn(255)),
63079
- blue: getset("rgb", 2, maxfn(255)),
63080
- hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, function (value) {
63081
- return (value % 360 + 360) % 360;
63082
- }),
63083
- saturationl: getset("hsl", 1, maxfn(100)),
63084
- lightness: getset("hsl", 2, maxfn(100)),
63085
- saturationv: getset("hsv", 1, maxfn(100)),
63086
- value: getset("hsv", 2, maxfn(100)),
63087
- chroma: getset("hcg", 1, maxfn(100)),
63088
- gray: getset("hcg", 2, maxfn(100)),
63089
- white: getset("hwb", 1, maxfn(100)),
63090
- wblack: getset("hwb", 2, maxfn(100)),
63091
- cyan: getset("cmyk", 0, maxfn(100)),
63092
- magenta: getset("cmyk", 1, maxfn(100)),
63093
- yellow: getset("cmyk", 2, maxfn(100)),
63094
- black: getset("cmyk", 3, maxfn(100)),
63095
- x: getset("xyz", 0, maxfn(95.047)),
63096
- y: getset("xyz", 1, maxfn(100)),
63097
- z: getset("xyz", 2, maxfn(108.833)),
63098
- l: getset("lab", 0, maxfn(100)),
63099
- a: getset("lab", 1),
63100
- b: getset("lab", 2),
63101
- keyword: function keyword(value) {
63102
- if (value !== undefined) {
63103
- return new Color(value);
63104
- }
63105
- return convert[this.model].keyword(this.color);
63106
- },
63107
- hex: function hex(value) {
63108
- if (value !== undefined) {
63109
- return new Color(value);
63110
- }
63111
- return colorString.to.hex(this.rgb().round().color);
63112
- },
63113
- hexa: function hexa(value) {
63114
- if (value !== undefined) {
63115
- return new Color(value);
63116
- }
63117
- var rgbArray = this.rgb().round().color;
63118
- var alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
63119
- if (alphaHex.length === 1) {
63120
- alphaHex = "0" + alphaHex;
63121
- }
63122
- return colorString.to.hex(rgbArray) + alphaHex;
63123
- },
63124
- rgbNumber: function rgbNumber() {
63125
- var rgb = this.rgb().color;
63126
- return (rgb[0] & 0xFF) << 16 | (rgb[1] & 0xFF) << 8 | rgb[2] & 0xFF;
63127
- },
63128
- luminosity: function luminosity() {
63129
- // http://www.w3.org/TR/WCAG20/#relativeluminancedef
63130
- var rgb = this.rgb().color;
63131
- var lum = [];
63132
- var _iteratorNormalCompletion = true,
63133
- _didIteratorError = false,
63134
- _iteratorError = undefined;
63135
- try {
63136
- for (var _iterator = rgb.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
63137
- var _step_value = _sliced_to_array(_step.value, 2),
63138
- i = _step_value[0],
63139
- element = _step_value[1];
63140
- var chan = element / 255;
63141
- lum[i] = chan <= 0.04045 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);
63142
- }
63143
- } catch (err) {
63144
- _didIteratorError = true;
63145
- _iteratorError = err;
63146
- } finally {
63147
- try {
63148
- if (!_iteratorNormalCompletion && _iterator.return != null) {
63149
- _iterator.return();
63150
- }
63151
- } finally {
63152
- if (_didIteratorError) {
63153
- throw _iteratorError;
63154
- }
63155
- }
63156
- }
63157
- return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
63158
- },
63159
- contrast: function contrast(color2) {
63160
- // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
63161
- var lum1 = this.luminosity();
63162
- var lum2 = color2.luminosity();
63163
- if (lum1 > lum2) {
63164
- return (lum1 + 0.05) / (lum2 + 0.05);
63165
- }
63166
- return (lum2 + 0.05) / (lum1 + 0.05);
63167
- },
63168
- level: function level(color2) {
63169
- // https://www.w3.org/TR/WCAG/#contrast-enhanced
63170
- var contrastRatio = this.contrast(color2);
63171
- if (contrastRatio >= 7) {
63172
- return "AAA";
63173
- }
63174
- return contrastRatio >= 4.5 ? "AA" : "";
63175
- },
63176
- isDark: function isDark() {
63177
- // YIQ equation from http://24ways.org/2010/calculating-color-contrast
63178
- var rgb = this.rgb().color;
63179
- var yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
63180
- return yiq < 128;
63181
- },
63182
- isLight: function isLight() {
63183
- return !this.isDark();
63184
- },
63185
- negate: function negate() {
63186
- var rgb = this.rgb();
63187
- for (var i = 0; i < 3; i++) {
63188
- rgb.color[i] = 255 - rgb.color[i];
63189
- }
63190
- return rgb;
63191
- },
63192
- lighten: function lighten(ratio) {
63193
- var hsl = this.hsl();
63194
- hsl.color[2] += hsl.color[2] * ratio;
63195
- return hsl;
63196
- },
63197
- darken: function darken(ratio) {
63198
- var hsl = this.hsl();
63199
- hsl.color[2] -= hsl.color[2] * ratio;
63200
- return hsl;
63201
- },
63202
- saturate: function saturate(ratio) {
63203
- var hsl = this.hsl();
63204
- hsl.color[1] += hsl.color[1] * ratio;
63205
- return hsl;
63206
- },
63207
- desaturate: function desaturate(ratio) {
63208
- var hsl = this.hsl();
63209
- hsl.color[1] -= hsl.color[1] * ratio;
63210
- return hsl;
63211
- },
63212
- whiten: function whiten(ratio) {
63213
- var hwb = this.hwb();
63214
- hwb.color[1] += hwb.color[1] * ratio;
63215
- return hwb;
63216
- },
63217
- blacken: function blacken(ratio) {
63218
- var hwb = this.hwb();
63219
- hwb.color[2] += hwb.color[2] * ratio;
63220
- return hwb;
63221
- },
63222
- grayscale: function grayscale() {
63223
- // http://en.wikipedia.org/wiki/Grayscale#Converting_colour_to_grayscale
63224
- var rgb = this.rgb().color;
63225
- var value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
63226
- return Color.rgb(value, value, value);
63227
- },
63228
- fade: function fade(ratio) {
63229
- return this.alpha(this.valpha - this.valpha * ratio);
63230
- },
63231
- opaquer: function opaquer(ratio) {
63232
- return this.alpha(this.valpha + this.valpha * ratio);
63233
- },
63234
- rotate: function rotate(degrees) {
63235
- var hsl = this.hsl();
63236
- var hue = hsl.color[0];
63237
- hue = (hue + degrees) % 360;
63238
- hue = hue < 0 ? 360 + hue : hue;
63239
- hsl.color[0] = hue;
63240
- return hsl;
63241
- },
63242
- mix: function mix(mixinColor, weight) {
63243
- // Ported from sass implementation in C
63244
- // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
63245
- if (!mixinColor || !mixinColor.rgb) {
63246
- throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + (typeof mixinColor === "undefined" ? "undefined" : _type_of(mixinColor)));
63247
- }
63248
- var color1 = mixinColor.rgb();
63249
- var color2 = this.rgb();
63250
- var p = weight === undefined ? 0.5 : weight;
63251
- var w = 2 * p - 1;
63252
- var a = color1.alpha() - color2.alpha();
63253
- var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
63254
- var w2 = 1 - w1;
63255
- return Color.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue(), color1.alpha() * p + color2.alpha() * (1 - p));
63132
+ return [hsl[0], c * 100, f * 100];
63133
+ };
63134
+ convert.hsv.hcg = function (hsv) {
63135
+ var s = hsv[1] / 100;
63136
+ var v = hsv[2] / 100;
63137
+ var c = s * v;
63138
+ var f = 0;
63139
+ if (c < 1.0) {
63140
+ f = (v - c) / (1 - c);
63256
63141
  }
63142
+ return [hsv[0], c * 100, f * 100];
63257
63143
  };
63258
- var _iteratorNormalCompletion1 = true,
63259
- _didIteratorError1 = false,
63260
- _iteratorError1 = undefined;
63261
- try {
63262
- var _loop = function _loop() {
63263
- var model = _step1.value;
63264
- if (skippedModels.includes(model)) {
63265
- return "continue";
63266
- }
63267
- var channels = convert[model].channels;
63268
- // Conversion methods
63269
- Color.prototype[model] = function () {
63270
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
63271
- args[_key] = arguments[_key];
63272
- }
63273
- if (this.model === model) {
63274
- return new Color(this);
63275
- }
63276
- if (args.length > 0) {
63277
- return new Color(args, model);
63278
- }
63279
- return new Color(_to_consumable_array(assertArray(convert[this.model][model].raw(this.color))).concat([this.valpha]), model);
63280
- };
63281
- // 'static' construction methods
63282
- Color[model] = function () {
63283
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
63284
- args[_key] = arguments[_key];
63285
- }
63286
- var color = args[0];
63287
- if (typeof color === "number") {
63288
- color = zeroArray(args, channels);
63289
- }
63290
- return new Color(color, model);
63291
- };
63292
- };
63293
- // Model conversion methods and static constructors
63294
- for (var _iterator1 = Object.keys(convert)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) _loop();
63295
- } catch (err) {
63296
- _didIteratorError1 = true;
63297
- _iteratorError1 = err;
63298
- } finally {
63299
- try {
63300
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
63301
- _iterator1.return();
63144
+ convert.hcg.rgb = function (hcg) {
63145
+ var h = hcg[0] / 360;
63146
+ var c = hcg[1] / 100;
63147
+ var g = hcg[2] / 100;
63148
+ if (c === 0.0) {
63149
+ return [g * 255, g * 255, g * 255];
63150
+ }
63151
+ var pure = [0, 0, 0];
63152
+ var hi = h % 1 * 6;
63153
+ var v = hi % 1;
63154
+ var w = 1 - v;
63155
+ var mg = 0;
63156
+
63157
+ /* eslint-disable max-statements-per-line */
63158
+ switch (Math.floor(hi)) {
63159
+ case 0:
63160
+ pure[0] = 1;
63161
+ pure[1] = v;
63162
+ pure[2] = 0;
63163
+ break;
63164
+ case 1:
63165
+ pure[0] = w;
63166
+ pure[1] = 1;
63167
+ pure[2] = 0;
63168
+ break;
63169
+ case 2:
63170
+ pure[0] = 0;
63171
+ pure[1] = 1;
63172
+ pure[2] = v;
63173
+ break;
63174
+ case 3:
63175
+ pure[0] = 0;
63176
+ pure[1] = w;
63177
+ pure[2] = 1;
63178
+ break;
63179
+ case 4:
63180
+ pure[0] = v;
63181
+ pure[1] = 0;
63182
+ pure[2] = 1;
63183
+ break;
63184
+ default:
63185
+ pure[0] = 1;
63186
+ pure[1] = 0;
63187
+ pure[2] = w;
63188
+ }
63189
+ /* eslint-enable max-statements-per-line */
63190
+
63191
+ mg = (1.0 - c) * g;
63192
+ return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
63193
+ };
63194
+ convert.hcg.hsv = function (hcg) {
63195
+ var c = hcg[1] / 100;
63196
+ var g = hcg[2] / 100;
63197
+ var v = c + g * (1.0 - c);
63198
+ var f = 0;
63199
+ if (v > 0.0) {
63200
+ f = c / v;
63201
+ }
63202
+ return [hcg[0], f * 100, v * 100];
63203
+ };
63204
+ convert.hcg.hsl = function (hcg) {
63205
+ var c = hcg[1] / 100;
63206
+ var g = hcg[2] / 100;
63207
+ var l = g * (1.0 - c) + 0.5 * c;
63208
+ var s = 0;
63209
+ if (l > 0.0 && l < 0.5) {
63210
+ s = c / (2 * l);
63211
+ } else if (l >= 0.5 && l < 1.0) {
63212
+ s = c / (2 * (1 - l));
63213
+ }
63214
+ return [hcg[0], s * 100, l * 100];
63215
+ };
63216
+ convert.hcg.hwb = function (hcg) {
63217
+ var c = hcg[1] / 100;
63218
+ var g = hcg[2] / 100;
63219
+ var v = c + g * (1.0 - c);
63220
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
63221
+ };
63222
+ convert.hwb.hcg = function (hwb) {
63223
+ var w = hwb[1] / 100;
63224
+ var b = hwb[2] / 100;
63225
+ var v = 1 - b;
63226
+ var c = v - w;
63227
+ var g = 0;
63228
+ if (c < 1) {
63229
+ g = (v - c) / (1 - c);
63230
+ }
63231
+ return [hwb[0], c * 100, g * 100];
63232
+ };
63233
+ convert.apple.rgb = function (apple) {
63234
+ return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
63235
+ };
63236
+ convert.rgb.apple = function (rgb) {
63237
+ return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
63238
+ };
63239
+ convert.gray.rgb = function (args) {
63240
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
63241
+ };
63242
+ convert.gray.hsl = function (args) {
63243
+ return [0, 0, args[0]];
63244
+ };
63245
+ convert.gray.hsv = convert.gray.hsl;
63246
+ convert.gray.hwb = function (gray) {
63247
+ return [0, 100, gray[0]];
63248
+ };
63249
+ convert.gray.cmyk = function (gray) {
63250
+ return [0, 0, 0, gray[0]];
63251
+ };
63252
+ convert.gray.lab = function (gray) {
63253
+ return [gray[0], 0, 0];
63254
+ };
63255
+ convert.gray.hex = function (gray) {
63256
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
63257
+ var integer = (val << 16) + (val << 8) + val;
63258
+ var string = integer.toString(16).toUpperCase();
63259
+ return '000000'.substring(string.length) + string;
63260
+ };
63261
+ convert.rgb.gray = function (rgb) {
63262
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
63263
+ return [val / 255 * 100];
63264
+ };
63265
+
63266
+ /***/ }),
63267
+
63268
+ /***/ "./node_modules/color/node_modules/color-convert/index.js":
63269
+ /*!****************************************************************!*\
63270
+ !*** ./node_modules/color/node_modules/color-convert/index.js ***!
63271
+ \****************************************************************/
63272
+ /*! no static exports found */
63273
+ /***/ (function(module, exports, __webpack_require__) {
63274
+
63275
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
63276
+ var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
63277
+ var route = __webpack_require__(/*! ./route */ "./node_modules/color/node_modules/color-convert/route.js");
63278
+ var convert = {};
63279
+ var models = Object.keys(conversions);
63280
+ function wrapRaw(fn) {
63281
+ var wrappedFn = function wrappedFn() {
63282
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
63283
+ args[_key] = arguments[_key];
63302
63284
  }
63303
- } finally {
63304
- if (_didIteratorError1) {
63305
- throw _iteratorError1;
63285
+ var arg0 = args[0];
63286
+ if (arg0 === undefined || arg0 === null) {
63287
+ return arg0;
63306
63288
  }
63307
- }
63308
- }
63309
- function roundTo(number, places) {
63310
- return Number(number.toFixed(places));
63311
- }
63312
- function roundToPlace(places) {
63313
- return function (number) {
63314
- return roundTo(number, places);
63289
+ if (arg0.length > 1) {
63290
+ args = arg0;
63291
+ }
63292
+ return fn(args);
63315
63293
  };
63294
+
63295
+ // Preserve .conversion property if there is one
63296
+ if ('conversion' in fn) {
63297
+ wrappedFn.conversion = fn.conversion;
63298
+ }
63299
+ return wrappedFn;
63316
63300
  }
63317
- function getset(model, channel, modifier) {
63318
- model = Array.isArray(model) ? model : [model];
63319
- var _iteratorNormalCompletion = true,
63320
- _didIteratorError = false,
63321
- _iteratorError = undefined;
63322
- try {
63323
- for (var _iterator = model[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
63324
- var m = _step.value;
63325
- (limiters[m] || (limiters[m] = []))[channel] = modifier;
63301
+ function wrapRounded(fn) {
63302
+ var wrappedFn = function wrappedFn() {
63303
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
63304
+ args[_key2] = arguments[_key2];
63326
63305
  }
63327
- } catch (err) {
63328
- _didIteratorError = true;
63329
- _iteratorError = err;
63330
- } finally {
63331
- try {
63332
- if (!_iteratorNormalCompletion && _iterator.return != null) {
63333
- _iterator.return();
63334
- }
63335
- } finally {
63336
- if (_didIteratorError) {
63337
- throw _iteratorError;
63338
- }
63306
+ var arg0 = args[0];
63307
+ if (arg0 === undefined || arg0 === null) {
63308
+ return arg0;
63339
63309
  }
63340
- }
63341
- model = model[0];
63342
- return function (value) {
63343
- var result;
63344
- if (value !== undefined) {
63345
- if (modifier) {
63346
- value = modifier(value);
63347
- }
63348
- result = this[model]();
63349
- result.color[channel] = value;
63350
- return result;
63310
+ if (arg0.length > 1) {
63311
+ args = arg0;
63351
63312
  }
63352
- result = this[model]().color[channel];
63353
- if (modifier) {
63354
- result = modifier(result);
63313
+ var result = fn(args);
63314
+
63315
+ // We're assuming the result is an array here.
63316
+ // see notice in conversions.js; don't use box types
63317
+ // in conversion functions.
63318
+ if (_typeof(result) === 'object') {
63319
+ for (var len = result.length, i = 0; i < len; i++) {
63320
+ result[i] = Math.round(result[i]);
63321
+ }
63355
63322
  }
63356
63323
  return result;
63357
63324
  };
63358
- }
63359
- function maxfn(max) {
63360
- return function (v) {
63361
- return Math.max(0, Math.min(max, v));
63362
- };
63363
- }
63364
- function assertArray(value) {
63365
- return Array.isArray(value) ? value : [value];
63366
- }
63367
- function zeroArray(array, length) {
63368
- for (var i = 0; i < length; i++) {
63369
- if (typeof array[i] !== "number") {
63370
- array[i] = 0;
63371
- }
63325
+
63326
+ // Preserve .conversion property if there is one
63327
+ if ('conversion' in fn) {
63328
+ wrappedFn.conversion = fn.conversion;
63372
63329
  }
63373
- return array;
63330
+ return wrappedFn;
63374
63331
  }
63375
- module.exports = Color;
63332
+ models.forEach(function (fromModel) {
63333
+ convert[fromModel] = {};
63334
+ Object.defineProperty(convert[fromModel], 'channels', {
63335
+ value: conversions[fromModel].channels
63336
+ });
63337
+ Object.defineProperty(convert[fromModel], 'labels', {
63338
+ value: conversions[fromModel].labels
63339
+ });
63340
+ var routes = route(fromModel);
63341
+ var routeModels = Object.keys(routes);
63342
+ routeModels.forEach(function (toModel) {
63343
+ var fn = routes[toModel];
63344
+ convert[fromModel][toModel] = wrapRounded(fn);
63345
+ convert[fromModel][toModel].raw = wrapRaw(fn);
63346
+ });
63347
+ });
63348
+ module.exports = convert;
63376
63349
 
63377
63350
  /***/ }),
63378
63351
 
63379
- /***/ "./node_modules/color-name/index.js":
63380
- /*!******************************************!*\
63381
- !*** ./node_modules/color-name/index.js ***!
63382
- \******************************************/
63352
+ /***/ "./node_modules/color/node_modules/color-convert/route.js":
63353
+ /*!****************************************************************!*\
63354
+ !*** ./node_modules/color/node_modules/color-convert/route.js ***!
63355
+ \****************************************************************/
63383
63356
  /*! no static exports found */
63384
63357
  /***/ (function(module, exports, __webpack_require__) {
63385
63358
 
63386
- "use strict";
63359
+ var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color/node_modules/color-convert/conversions.js");
63387
63360
 
63361
+ /*
63362
+ This function routes a model to all other models.
63388
63363
 
63389
- module.exports = {
63390
- "aliceblue": [240, 248, 255],
63391
- "antiquewhite": [250, 235, 215],
63392
- "aqua": [0, 255, 255],
63393
- "aquamarine": [127, 255, 212],
63394
- "azure": [240, 255, 255],
63395
- "beige": [245, 245, 220],
63396
- "bisque": [255, 228, 196],
63397
- "black": [0, 0, 0],
63398
- "blanchedalmond": [255, 235, 205],
63399
- "blue": [0, 0, 255],
63400
- "blueviolet": [138, 43, 226],
63401
- "brown": [165, 42, 42],
63402
- "burlywood": [222, 184, 135],
63403
- "cadetblue": [95, 158, 160],
63404
- "chartreuse": [127, 255, 0],
63405
- "chocolate": [210, 105, 30],
63406
- "coral": [255, 127, 80],
63407
- "cornflowerblue": [100, 149, 237],
63408
- "cornsilk": [255, 248, 220],
63409
- "crimson": [220, 20, 60],
63410
- "cyan": [0, 255, 255],
63411
- "darkblue": [0, 0, 139],
63412
- "darkcyan": [0, 139, 139],
63413
- "darkgoldenrod": [184, 134, 11],
63414
- "darkgray": [169, 169, 169],
63415
- "darkgreen": [0, 100, 0],
63416
- "darkgrey": [169, 169, 169],
63417
- "darkkhaki": [189, 183, 107],
63418
- "darkmagenta": [139, 0, 139],
63419
- "darkolivegreen": [85, 107, 47],
63420
- "darkorange": [255, 140, 0],
63421
- "darkorchid": [153, 50, 204],
63422
- "darkred": [139, 0, 0],
63423
- "darksalmon": [233, 150, 122],
63424
- "darkseagreen": [143, 188, 143],
63425
- "darkslateblue": [72, 61, 139],
63426
- "darkslategray": [47, 79, 79],
63427
- "darkslategrey": [47, 79, 79],
63428
- "darkturquoise": [0, 206, 209],
63429
- "darkviolet": [148, 0, 211],
63430
- "deeppink": [255, 20, 147],
63431
- "deepskyblue": [0, 191, 255],
63432
- "dimgray": [105, 105, 105],
63433
- "dimgrey": [105, 105, 105],
63434
- "dodgerblue": [30, 144, 255],
63435
- "firebrick": [178, 34, 34],
63436
- "floralwhite": [255, 250, 240],
63437
- "forestgreen": [34, 139, 34],
63438
- "fuchsia": [255, 0, 255],
63439
- "gainsboro": [220, 220, 220],
63440
- "ghostwhite": [248, 248, 255],
63441
- "gold": [255, 215, 0],
63442
- "goldenrod": [218, 165, 32],
63443
- "gray": [128, 128, 128],
63444
- "green": [0, 128, 0],
63445
- "greenyellow": [173, 255, 47],
63446
- "grey": [128, 128, 128],
63447
- "honeydew": [240, 255, 240],
63448
- "hotpink": [255, 105, 180],
63449
- "indianred": [205, 92, 92],
63450
- "indigo": [75, 0, 130],
63451
- "ivory": [255, 255, 240],
63452
- "khaki": [240, 230, 140],
63453
- "lavender": [230, 230, 250],
63454
- "lavenderblush": [255, 240, 245],
63455
- "lawngreen": [124, 252, 0],
63456
- "lemonchiffon": [255, 250, 205],
63457
- "lightblue": [173, 216, 230],
63458
- "lightcoral": [240, 128, 128],
63459
- "lightcyan": [224, 255, 255],
63460
- "lightgoldenrodyellow": [250, 250, 210],
63461
- "lightgray": [211, 211, 211],
63462
- "lightgreen": [144, 238, 144],
63463
- "lightgrey": [211, 211, 211],
63464
- "lightpink": [255, 182, 193],
63465
- "lightsalmon": [255, 160, 122],
63466
- "lightseagreen": [32, 178, 170],
63467
- "lightskyblue": [135, 206, 250],
63468
- "lightslategray": [119, 136, 153],
63469
- "lightslategrey": [119, 136, 153],
63470
- "lightsteelblue": [176, 196, 222],
63471
- "lightyellow": [255, 255, 224],
63472
- "lime": [0, 255, 0],
63473
- "limegreen": [50, 205, 50],
63474
- "linen": [250, 240, 230],
63475
- "magenta": [255, 0, 255],
63476
- "maroon": [128, 0, 0],
63477
- "mediumaquamarine": [102, 205, 170],
63478
- "mediumblue": [0, 0, 205],
63479
- "mediumorchid": [186, 85, 211],
63480
- "mediumpurple": [147, 112, 219],
63481
- "mediumseagreen": [60, 179, 113],
63482
- "mediumslateblue": [123, 104, 238],
63483
- "mediumspringgreen": [0, 250, 154],
63484
- "mediumturquoise": [72, 209, 204],
63485
- "mediumvioletred": [199, 21, 133],
63486
- "midnightblue": [25, 25, 112],
63487
- "mintcream": [245, 255, 250],
63488
- "mistyrose": [255, 228, 225],
63489
- "moccasin": [255, 228, 181],
63490
- "navajowhite": [255, 222, 173],
63491
- "navy": [0, 0, 128],
63492
- "oldlace": [253, 245, 230],
63493
- "olive": [128, 128, 0],
63494
- "olivedrab": [107, 142, 35],
63495
- "orange": [255, 165, 0],
63496
- "orangered": [255, 69, 0],
63497
- "orchid": [218, 112, 214],
63498
- "palegoldenrod": [238, 232, 170],
63499
- "palegreen": [152, 251, 152],
63500
- "paleturquoise": [175, 238, 238],
63501
- "palevioletred": [219, 112, 147],
63502
- "papayawhip": [255, 239, 213],
63503
- "peachpuff": [255, 218, 185],
63504
- "peru": [205, 133, 63],
63505
- "pink": [255, 192, 203],
63506
- "plum": [221, 160, 221],
63507
- "powderblue": [176, 224, 230],
63508
- "purple": [128, 0, 128],
63509
- "rebeccapurple": [102, 51, 153],
63510
- "red": [255, 0, 0],
63511
- "rosybrown": [188, 143, 143],
63512
- "royalblue": [65, 105, 225],
63513
- "saddlebrown": [139, 69, 19],
63514
- "salmon": [250, 128, 114],
63515
- "sandybrown": [244, 164, 96],
63516
- "seagreen": [46, 139, 87],
63517
- "seashell": [255, 245, 238],
63518
- "sienna": [160, 82, 45],
63519
- "silver": [192, 192, 192],
63520
- "skyblue": [135, 206, 235],
63521
- "slateblue": [106, 90, 205],
63522
- "slategray": [112, 128, 144],
63523
- "slategrey": [112, 128, 144],
63524
- "snow": [255, 250, 250],
63525
- "springgreen": [0, 255, 127],
63526
- "steelblue": [70, 130, 180],
63527
- "tan": [210, 180, 140],
63528
- "teal": [0, 128, 128],
63529
- "thistle": [216, 191, 216],
63530
- "tomato": [255, 99, 71],
63531
- "turquoise": [64, 224, 208],
63532
- "violet": [238, 130, 238],
63533
- "wheat": [245, 222, 179],
63534
- "white": [255, 255, 255],
63535
- "whitesmoke": [245, 245, 245],
63536
- "yellow": [255, 255, 0],
63537
- "yellowgreen": [154, 205, 50]
63538
- };
63364
+ all functions that are routed have a property `.conversion` attached
63365
+ to the returned synthetic function. This property is an array
63366
+ of strings, each with the steps in between the 'from' and 'to'
63367
+ color models (inclusive).
63539
63368
 
63540
- /***/ }),
63369
+ conversions that are not possible simply are not included.
63370
+ */
63541
63371
 
63542
- /***/ "./node_modules/color-string/index.js":
63543
- /*!********************************************!*\
63544
- !*** ./node_modules/color-string/index.js ***!
63545
- \********************************************/
63546
- /*! no static exports found */
63547
- /***/ (function(module, exports, __webpack_require__) {
63372
+ function buildGraph() {
63373
+ var graph = {};
63374
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
63375
+ var models = Object.keys(conversions);
63376
+ for (var len = models.length, i = 0; i < len; i++) {
63377
+ graph[models[i]] = {
63378
+ // http://jsperf.com/1-vs-infinity
63379
+ // micro-opt, but this is simple.
63380
+ distance: -1,
63381
+ parent: null
63382
+ };
63383
+ }
63384
+ return graph;
63385
+ }
63548
63386
 
63549
- /* MIT license */
63550
- var colorNames = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js");
63551
- var swizzle = __webpack_require__(/*! simple-swizzle */ "./node_modules/simple-swizzle/index.js");
63552
- var hasOwnProperty = Object.hasOwnProperty;
63553
- var reverseNames = Object.create(null);
63387
+ // https://en.wikipedia.org/wiki/Breadth-first_search
63388
+ function deriveBFS(fromModel) {
63389
+ var graph = buildGraph();
63390
+ var queue = [fromModel]; // Unshift -> queue -> pop
63554
63391
 
63555
- // create a list of reverse color names
63556
- for (var name in colorNames) {
63557
- if (hasOwnProperty.call(colorNames, name)) {
63558
- reverseNames[colorNames[name]] = name;
63392
+ graph[fromModel].distance = 0;
63393
+ while (queue.length) {
63394
+ var current = queue.pop();
63395
+ var adjacents = Object.keys(conversions[current]);
63396
+ for (var len = adjacents.length, i = 0; i < len; i++) {
63397
+ var adjacent = adjacents[i];
63398
+ var node = graph[adjacent];
63399
+ if (node.distance === -1) {
63400
+ node.distance = graph[current].distance + 1;
63401
+ node.parent = current;
63402
+ queue.unshift(adjacent);
63403
+ }
63404
+ }
63559
63405
  }
63406
+ return graph;
63560
63407
  }
63561
- var cs = module.exports = {
63562
- to: {},
63563
- get: {}
63564
- };
63565
- cs.get = function (string) {
63566
- var prefix = string.substring(0, 3).toLowerCase();
63567
- var val;
63568
- var model;
63569
- switch (prefix) {
63570
- case 'hsl':
63571
- val = cs.get.hsl(string);
63572
- model = 'hsl';
63573
- break;
63574
- case 'hwb':
63575
- val = cs.get.hwb(string);
63576
- model = 'hwb';
63577
- break;
63578
- default:
63579
- val = cs.get.rgb(string);
63580
- model = 'rgb';
63581
- break;
63582
- }
63583
- if (!val) {
63584
- return null;
63585
- }
63586
- return {
63587
- model: model,
63588
- value: val
63408
+ function link(from, to) {
63409
+ return function (args) {
63410
+ return to(from(args));
63589
63411
  };
63590
- };
63591
- cs.get.rgb = function (string) {
63592
- if (!string) {
63593
- return null;
63412
+ }
63413
+ function wrapConversion(toModel, graph) {
63414
+ var path = [graph[toModel].parent, toModel];
63415
+ var fn = conversions[graph[toModel].parent][toModel];
63416
+ var cur = graph[toModel].parent;
63417
+ while (graph[cur].parent) {
63418
+ path.unshift(graph[cur].parent);
63419
+ fn = link(conversions[graph[cur].parent][cur], fn);
63420
+ cur = graph[cur].parent;
63594
63421
  }
63595
- var abbr = /^#([a-f0-9]{3,4})$/i;
63596
- var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
63597
- var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
63598
- var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
63599
- var keyword = /^(\w+)$/;
63600
- var rgb = [0, 0, 0, 1];
63601
- var match;
63602
- var i;
63603
- var hexAlpha;
63604
- if (match = string.match(hex)) {
63605
- hexAlpha = match[2];
63606
- match = match[1];
63607
- for (i = 0; i < 3; i++) {
63608
- // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
63609
- var i2 = i * 2;
63610
- rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
63611
- }
63612
- if (hexAlpha) {
63613
- rgb[3] = parseInt(hexAlpha, 16) / 255;
63614
- }
63615
- } else if (match = string.match(abbr)) {
63616
- match = match[1];
63617
- hexAlpha = match[3];
63618
- for (i = 0; i < 3; i++) {
63619
- rgb[i] = parseInt(match[i] + match[i], 16);
63620
- }
63621
- if (hexAlpha) {
63622
- rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
63623
- }
63624
- } else if (match = string.match(rgba)) {
63625
- for (i = 0; i < 3; i++) {
63626
- rgb[i] = parseInt(match[i + 1], 0);
63627
- }
63628
- if (match[4]) {
63629
- if (match[5]) {
63630
- rgb[3] = parseFloat(match[4]) * 0.01;
63631
- } else {
63632
- rgb[3] = parseFloat(match[4]);
63633
- }
63634
- }
63635
- } else if (match = string.match(per)) {
63636
- for (i = 0; i < 3; i++) {
63637
- rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
63638
- }
63639
- if (match[4]) {
63640
- if (match[5]) {
63641
- rgb[3] = parseFloat(match[4]) * 0.01;
63642
- } else {
63643
- rgb[3] = parseFloat(match[4]);
63644
- }
63645
- }
63646
- } else if (match = string.match(keyword)) {
63647
- if (match[1] === 'transparent') {
63648
- return [0, 0, 0, 0];
63649
- }
63650
- if (!hasOwnProperty.call(colorNames, match[1])) {
63651
- return null;
63422
+ fn.conversion = path;
63423
+ return fn;
63424
+ }
63425
+ module.exports = function (fromModel) {
63426
+ var graph = deriveBFS(fromModel);
63427
+ var conversion = {};
63428
+ var models = Object.keys(graph);
63429
+ for (var len = models.length, i = 0; i < len; i++) {
63430
+ var toModel = models[i];
63431
+ var node = graph[toModel];
63432
+ if (node.parent === null) {
63433
+ // No possible conversion, or this node is the source model.
63434
+ continue;
63652
63435
  }
63653
- rgb = colorNames[match[1]];
63654
- rgb[3] = 1;
63655
- return rgb;
63656
- } else {
63657
- return null;
63658
- }
63659
- for (i = 0; i < 3; i++) {
63660
- rgb[i] = clamp(rgb[i], 0, 255);
63661
- }
63662
- rgb[3] = clamp(rgb[3], 0, 1);
63663
- return rgb;
63664
- };
63665
- cs.get.hsl = function (string) {
63666
- if (!string) {
63667
- return null;
63668
- }
63669
- var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
63670
- var match = string.match(hsl);
63671
- if (match) {
63672
- var alpha = parseFloat(match[4]);
63673
- var h = (parseFloat(match[1]) % 360 + 360) % 360;
63674
- var s = clamp(parseFloat(match[2]), 0, 100);
63675
- var l = clamp(parseFloat(match[3]), 0, 100);
63676
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
63677
- return [h, s, l, a];
63678
- }
63679
- return null;
63680
- };
63681
- cs.get.hwb = function (string) {
63682
- if (!string) {
63683
- return null;
63684
- }
63685
- var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
63686
- var match = string.match(hwb);
63687
- if (match) {
63688
- var alpha = parseFloat(match[4]);
63689
- var h = (parseFloat(match[1]) % 360 + 360) % 360;
63690
- var w = clamp(parseFloat(match[2]), 0, 100);
63691
- var b = clamp(parseFloat(match[3]), 0, 100);
63692
- var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
63693
- return [h, w, b, a];
63694
- }
63695
- return null;
63696
- };
63697
- cs.to.hex = function () {
63698
- var rgba = swizzle(arguments);
63699
- return '#' + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : '');
63700
- };
63701
- cs.to.rgb = function () {
63702
- var rgba = swizzle(arguments);
63703
- return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')' : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
63704
- };
63705
- cs.to.rgb.percent = function () {
63706
- var rgba = swizzle(arguments);
63707
- var r = Math.round(rgba[0] / 255 * 100);
63708
- var g = Math.round(rgba[1] / 255 * 100);
63709
- var b = Math.round(rgba[2] / 255 * 100);
63710
- return rgba.length < 4 || rgba[3] === 1 ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)' : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
63711
- };
63712
- cs.to.hsl = function () {
63713
- var hsla = swizzle(arguments);
63714
- return hsla.length < 4 || hsla[3] === 1 ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)' : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
63715
- };
63716
-
63717
- // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
63718
- // (hwb have alpha optional & 1 is default value)
63719
- cs.to.hwb = function () {
63720
- var hwba = swizzle(arguments);
63721
- var a = '';
63722
- if (hwba.length >= 4 && hwba[3] !== 1) {
63723
- a = ', ' + hwba[3];
63436
+ conversion[toModel] = wrapConversion(toModel, graph);
63724
63437
  }
63725
- return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
63726
- };
63727
- cs.to.keyword = function (rgb) {
63728
- return reverseNames[rgb.slice(0, 3)];
63438
+ return conversion;
63729
63439
  };
63730
63440
 
63731
- // helpers
63732
- function clamp(num, min, max) {
63733
- return Math.min(Math.max(min, num), max);
63734
- }
63735
- function hexDouble(num) {
63736
- var str = Math.round(num).toString(16).toUpperCase();
63737
- return str.length < 2 ? '0' + str : str;
63738
- }
63739
-
63740
63441
  /***/ }),
63741
63442
 
63742
63443
  /***/ "./node_modules/core-js-pure/actual/array/from.js":