parsegraph-color
Advanced tools
Comparing version 1.4.7-dev to 1.4.7
@@ -9,4 +9,4 @@ export default class ColorChannel { | ||
value(): number; | ||
elems(): (HTMLDivElement | HTMLLabelElement)[]; | ||
elems(): (HTMLLabelElement | HTMLDivElement)[]; | ||
} | ||
//# sourceMappingURL=ColorChannel.d.ts.map |
@@ -1,108 +0,1 @@ | ||
/* | ||
* ATTENTION: An "eval-source-map" devtool has been used. | ||
* This devtool is neither made for production nor for readable output files. | ||
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. | ||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) | ||
* or disable the default devtool with "devtool: false". | ||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). | ||
*/ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["parsegraph_color"] = factory(); | ||
else | ||
root["parsegraph_color"] = factory(); | ||
})(this, function() { | ||
return /******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ var __webpack_modules__ = ({ | ||
/***/ "./src/index.ts": | ||
/*!**********************!*\ | ||
!*** ./src/index.ts ***! | ||
\**********************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"clamp\": () => (/* binding */ clamp),\n/* harmony export */ \"mix\": () => (/* binding */ mix),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _w3c__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./w3c */ \"./src/w3c.ts\");\n/* eslint-disable require-jsdoc */\n\n/* eslint-disable camelcase */\n\n/* eslint-disable new-cap */\n\nvar clamp = function clamp(val, min, max) {\n return Math.min(max, Math.max(min, val));\n};\nvar mix = function mix(a, b, interp) {\n return a + (b - a) * interp;\n};\n\nvar Color =\n/** @class */\nfunction () {\n function Color(r, g, b, a) {\n if (arguments.length === 1) {\n g = r;\n b = r;\n a = 1;\n } else if (arguments.length === 3) {\n a = 1;\n } else if (arguments.length !== 4) {\n throw new Error(\"Color must be given initial component values.\");\n }\n\n this._r = Math.min(1, Math.max(0, r));\n this._g = Math.min(1, Math.max(0, g));\n this._b = Math.min(1, Math.max(0, b));\n this._a = Math.min(1, Math.max(0, a));\n }\n\n Color.prototype.r = function () {\n return this._r;\n };\n\n Color.prototype.g = function () {\n return this._g;\n };\n\n Color.prototype.b = function () {\n return this._b;\n };\n\n Color.prototype.a = function () {\n return this._a;\n };\n\n Color.prototype.setA = function (value) {\n this._a = Math.min(1, Math.max(0, value));\n return this;\n };\n\n Color.prototype.setR = function (value) {\n this._r = Math.min(1, Math.max(0, value));\n return this;\n };\n\n Color.prototype.setG = function (value) {\n this._g = Math.min(1, Math.max(0, value));\n return this;\n };\n\n Color.prototype.setB = function (value) {\n this._b = Math.min(1, Math.max(0, value));\n return this;\n };\n\n Color.prototype.multiply = function (other) {\n return new Color(this.r() * other.r(), this.g() * other.g(), this.b() * other.b(), this.a() * other.a());\n };\n\n Color.prototype.premultiply = function (other) {\n return new Color(this.a() * this.r() + other.r() * (1.0 - this.a()), this.a() * this.g() + other.g() * (1.0 - this.a()), this.a() * this.b() + other.b() * (1.0 - this.a()), 1.0);\n };\n\n Color.prototype.asRGB = function () {\n return \"rgb(\" + Math.round(this._r * 255) + \", \" + Math.round(this._g * 255) + \", \" + Math.round(this._b * 255) + \")\";\n };\n\n Color.prototype.asRGBA = function () {\n return \"rgba(\" + Math.round(this._r * 255) + \", \" + Math.round(this._g * 255) + \", \" + Math.round(this._b * 255) + \", \" + Math.round(this._a * 255) + \")\";\n };\n\n Color.prototype.luminance = function () {\n // sRGB color model.\n var x1 = Color.inverseSRGBCompanding(this.r());\n var y1 = Color.inverseSRGBCompanding(this.g());\n var z1 = Color.inverseSRGBCompanding(this.b());\n var R_LUMINANCE = 0.648431;\n var G_LUMINANCE = 0.321152;\n var B_LUMINANCE = 0.155886;\n return x1 * R_LUMINANCE + y1 * G_LUMINANCE + z1 * B_LUMINANCE;\n };\n\n Color.prototype.toLCH = function () {\n var x1 = Color.inverseSRGBCompanding(this.r());\n var y1 = Color.inverseSRGBCompanding(this.g());\n var z1 = Color.inverseSRGBCompanding(this.b());\n return (0,_w3c__WEBPACK_IMPORTED_MODULE_0__.Lab_to_LCH)((0,_w3c__WEBPACK_IMPORTED_MODULE_0__.XYZ_to_Lab)([x1, y1, z1]));\n };\n\n Color.prototype.interpolate = function (other, interp) {\n // console.log(\"Interpolating\");\n interp = clamp(interp, 0, 1);\n\n var _c = this.toLCH(),\n L1 = _c[0],\n C1 = _c[1],\n H1 = _c[2];\n\n var _d = other.toLCH(),\n L2 = _d[0],\n C2 = _d[1],\n H2 = _d[2];\n\n var L3 = mix(L1, L2, interp);\n var C3 = mix(C1, C2, interp);\n var H3 = mix(H1, H2, interp); // console.log(\"L3=\" + L3 + \", C3=\" + C3 + \", H3=\" + H3);\n\n return Color.fromLCH(L3, C3, H3, mix(this.a(), other.a(), interp));\n };\n\n Color.prototype.clone = function () {\n return new Color(this.r(), this.g(), this.b(), this.a());\n };\n\n Color.prototype.equals = function (other) {\n return this.r() === other.r() && this.g() === other.g() && this.b() === other.b() && this.a() === other.a();\n };\n\n Color.fromLCH = function (L3, C3, H3, a) {\n var _c = (0,_w3c__WEBPACK_IMPORTED_MODULE_0__.Lab_to_XYZ)((0,_w3c__WEBPACK_IMPORTED_MODULE_0__.LCH_to_Lab)([L3, C3, H3])),\n x3 = _c[0],\n y3 = _c[1],\n z3 = _c[2];\n\n return new Color(Color.sRGBCompanding(x3), Color.sRGBCompanding(y3), Color.sRGBCompanding(z3), a);\n };\n\n Color.inverseSRGBCompanding = function (v) {\n if (v <= 0.04045) {\n return v / 12.92;\n }\n\n return Math.pow((v + 0.055) / 1.055, 2.4);\n };\n\n Color.sRGBCompanding = function (v) {\n if (v <= 0.0031308) {\n return v * 12.92;\n }\n\n return 1.055 * Math.pow(v, 1 / 2.4) - 0.055;\n };\n\n Color.fromRGB = function (rgb, defaultAlpha) {\n // Default alpha to 255.\n if (arguments.length === 1) {\n defaultAlpha = 255;\n } // Extract the color from the string, as formatted in asRGB.\n\n\n var value = [];\n rgb.trim().substring(\"rgb(\".length, rgb.length - 1).split(\",\").forEach(function (c) {\n value.push(parseInt(c.trim()));\n });\n\n if (value.length < 3) {\n throw new Error(\"Failed to parse color\");\n }\n\n if (value.length === 3) {\n value.push(defaultAlpha);\n } // Return a new color.\n\n\n return new Color(value[0] / 255, value[1] / 255, value[2] / 255, value[3] / 255);\n };\n\n Color.random = function (range, alpha) {\n if (range === void 0) {\n range = 1;\n }\n\n if (alpha === void 0) {\n alpha = 1;\n }\n\n range = Math.min(Math.max(0, range), 1);\n var clamped = 1 - range;\n return new Color(range * Math.random() + clamped / 2, range * Math.random() + clamped / 2, range * Math.random() + clamped / 2, alpha);\n };\n\n return Color;\n}();\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Color);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvaW5kZXgudHMuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBOztBQUNBOztBQUNBO0FBQ0E7QUFDTyxJQUFJSSxLQUFLLEdBQUcsU0FBUkEsS0FBUSxDQUFVQyxHQUFWLEVBQWVDLEdBQWYsRUFBb0JDLEdBQXBCLEVBQXlCO0FBQ3hDLFNBQU9DLElBQUksQ0FBQ0YsR0FBTCxDQUFTQyxHQUFULEVBQWNDLElBQUksQ0FBQ0QsR0FBTCxDQUFTRCxHQUFULEVBQWNELEdBQWQsQ0FBZCxDQUFQO0FBQ0gsQ0FGTTtBQUdBLElBQUlJLEdBQ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y5cIik7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy5fciA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIHIpKTtcbiAgICAgICAgdGhpcy5fZyA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIGcpKTtcbiAgICAgICAgdGhpcy5fYiA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIGIpKTtcbiAgICAgICAgdGhpcy5fYSA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIGEpKTtcbiAgICB9XG4gICAgQ29sb3IucHJvdG90eXBlLnIgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9yO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLmcgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9nO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLmIgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9iO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLmEgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLl9hO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLnNldEEgPSBmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgdGhpcy5fYSA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIHZhbHVlKSk7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLnNldFIgPSBmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgdGhpcy5fciA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIHZhbHVlKSk7XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgIH07XG4gICAgQ29sb3IucHJvdG90eXBlLnNldEcgPSBmdW5jdGlvbiAodmFsdWUpIHtcbiAgICAgICAgdGhpcy5fZyA9IE1hdGgubWluKDEsIE1hdGgub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ge1xuICAgICAgICByZXR1cm4gbmV3IENvbG9yKHRoaXMucigpLCB0aGlzLmcoKSwgdGhpcy5iKCksIHRoaXMuYSgpKTtcbiAgICB9O1xuICAgIENvbG9yLnByb3RvdHlwZS5lcXVhbHMgPSBmdW5jdGlvbiAob3RoZXIpIHtcbiAgICAgICAgcmV0dXJuICh0aGlzLnIoKSA9PT0gb3RoZXIucigpICYmXG4gICAgICAgICAgICB0aGlzLmcoKSA9PT0gb3RoZXIuZygpICYmXG4gICAgICAgICAgICB0aGlzLmIoKSA9PT0gb3RoZXIuYigpICYmXG4gICAgICAgICAgICB0aGlzLmEoKSA9PT0gb3RoZXIuYSgpKTtcbiAgICB9O1xuICAgIENvbG9yLmZyb21MQ0ggPSBmdW5jdGlvbiAoTDMsIEMzLCBIMywgYSkge1xuICAgICAgICB2YXIgX2MgPSBMYWJfdG9fWFlaKExDSF90b19MYWIoW0wzLCBDMywgSDNdKSksIHgzID0gX2NbMF0sIHkzID0gX2NbMV0sIHozID0gX2NbMl07XG4gICAgICAgIHJldHVybiBuZXcgQ29sb3IoQ29sb3Iuc1JHQkNvbXBhbmRpbmcoeDMpLCBDb2xvci5zUkdCQ29tcGFuZGluZyh5MyksIENvbG9yLnNSR0JDb21wYW5kaW5nKHozKSwgYSk7XG4gICAgfTtcbiAgICBDb2xvci5pbnZlcnNlU1JHQkNvbXBhbmRpbmcgPSBmdW5jdGlvbiAodikge1xuICAgICAgICBpZiAodiA8PSAwLjA0MDQ1KSB7XG4gICAgICAgICAgICByZXR1cm4gdiAvIDEyLjkyO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBNYXRoLnBvdygodiArIDAuMDU1KSAvIDEuMDU1LCAyLjQpO1xuICAgIH07XG4gICAgQ29sb3Iuc1JHQkNvbXBhbmRpbmcgPSBmdW5jdGlvbiAodikge1xuICAgICAgICBpZiAodiA8PSAwLjAwMzEzMDgpIHtcbiAgICAgICAgICAgIHJldHVybiB2ICogMTIuOTI7XG4gICAgICAgIH1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UlOQU5DRSIsInRvTENIIiwiaW50ZXJwb2xhdGUiLCJfYyIsIkwxIiwiQzEiLCJIMSIsIl9kIiwiTDIiLCJDMiIsIkgyIiwiTDMiLCJDMyIsIkgzIiwiZnJvbUxDSCIsImNsb25lIiwiZXF1YWxzIiwieDMiLCJ5MyIsInozIiwic1JHQkNvbXBhbmRpbmciLCJ2IiwicG93IiwiZnJvbVJHQiIsInJnYiIsImRlZmF1bHRBbHBoYSIsInRyaW0iLCJzdWJzdHJpbmciLCJzcGxpdCIsImZvckVhY2giLCJjIiwicHVzaCIsInBhcnNlSW50IiwicmFuZG9tIiwicmFuZ2UiLCJhbHBoYSIsImNsYW1wZWQiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/index.ts\n"); | ||
/***/ }), | ||
/***/ "./src/w3c.ts": | ||
/*!********************!*\ | ||
!*** ./src/w3c.ts ***! | ||
\********************/ | ||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"XYZ_to_Lab\": () => (/* binding */ XYZ_to_Lab),\n/* harmony export */ \"Lab_to_XYZ\": () => (/* binding */ Lab_to_XYZ),\n/* harmony export */ \"Lab_to_LCH\": () => (/* binding */ Lab_to_LCH),\n/* harmony export */ \"LCH_to_Lab\": () => (/* binding */ LCH_to_Lab)\n/* harmony export */ });\nfunction XYZ_to_Lab(XYZ) {\n // Assuming XYZ is relative to D50, convert to CIE Lab\n // from CIE standard, which now defines these as a rational fraction\n var ε = 216 / 24389; // 6^3/29^3\n\n var κ = 24389 / 27; // 29^3/3^3\n\n var white = [0.96422, 1.0, 0.82521]; // D50 reference white\n // compute xyz, which is XYZ scaled relative to reference white\n\n var xyz = XYZ.map(function (value, i) {\n return value / white[i];\n }); // now compute f\n\n var f = xyz.map(function (value) {\n return value > ε ? Math.cbrt(value) : (κ * value + 16) / 116;\n });\n return [116 * f[1] - 16, 500 * (f[0] - f[1]), 200 * (f[1] - f[2]) // b\n ];\n}\nfunction Lab_to_XYZ(Lab) {\n // Convert Lab to D50-adapted XYZ\n // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n var κ = 24389 / 27; // 29^3/3^3\n\n var ε = 216 / 24389; // 6^3/29^3\n\n var white = [0.96422, 1.0, 0.82521]; // D50 reference white\n\n var f = []; // compute f, starting with the luminance-related term\n\n f[1] = (Lab[0] + 16) / 116;\n f[0] = Lab[1] / 500 + f[1];\n f[2] = f[1] - Lab[2] / 200; // compute xyz\n\n var xyz = [Math.pow(f[0], 3) > ε ? Math.pow(f[0], 3) : (116 * f[0] - 16) / κ, Lab[0] > κ * ε ? Math.pow((Lab[0] + 16) / 116, 3) : Lab[0] / κ, Math.pow(f[2], 3) > ε ? Math.pow(f[2], 3) : (116 * f[2] - 16) / κ]; // Compute XYZ by scaling xyz by reference white\n\n return xyz.map(function (value, i) {\n return value * white[i];\n });\n}\nfunction Lab_to_LCH(Lab) {\n // Convert to polar form\n var hue = Math.atan2(Lab[2], Lab[1]) * 180 / Math.PI;\n return [Lab[0], Math.sqrt(Math.pow(Lab[1], 2) + Math.pow(Lab[2], 2)), hue >= 0 ? hue : hue + 360 // Hue, in degrees [0 to 360)\n ];\n}\nfunction LCH_to_Lab(LCH) {\n // Convert from polar form\n return [LCH[0], LCH[1] * Math.cos(LCH[2] * Math.PI / 180), LCH[1] * Math.sin(LCH[2] * Math.PI / 180) // b\n ];\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdzNjLnRzLmpzIiwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBTyxTQUFTQSxVQUFULENBQW9CQyxHQUFwQixFQUF5QjtBQUM1QjtBQUNBO0FBQ0EsTUFBSUMsQ0FBQyxHQUFHLE1BQU0sS0FBZCxDQUg0QixDQUdQOztBQUNyQix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Q0hbMV0gKiBNYXRoLnNpbigoTENIWzJdICogTWF0aC5QSSkgLyAxODApLCAvLyBiXG4gICAgXTtcbn1cbiJdLCJuYW1lcyI6WyJYWVpfdG9fTGFiIiwiWFlaIiwizrUiLCLOuiIsIndoaXRlIiwieHl6IiwibWFwIiwidmFsdWUiLCJpIiwiZiIsIk1hdGgiLCJjYnJ0IiwiTGFiX3RvX1hZWiIsIkxhYiIsInBvdyIsIkxhYl90b19MQ0giLCJodWUiLCJhdGFuMiIsIlBJIiwic3FydCIsIkxDSF90b19MYWIiLCJMQ0giLCJjb3MiLCJzaW4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/w3c.ts\n"); | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
/******/ /* webpack/runtime/define property getters */ | ||
/******/ (() => { | ||
/******/ // define getter functions for harmony exports | ||
/******/ __webpack_require__.d = (exports, definition) => { | ||
/******/ for(var key in definition) { | ||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
/******/ } | ||
/******/ } | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
/******/ (() => { | ||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
/******/ })(); | ||
/******/ | ||
/******/ /* webpack/runtime/make namespace object */ | ||
/******/ (() => { | ||
/******/ // define __esModule on exports | ||
/******/ __webpack_require__.r = (exports) => { | ||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
/******/ } | ||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
/******/ }; | ||
/******/ })(); | ||
/******/ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module can't be inlined because the eval-source-map devtool is used. | ||
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts"); | ||
/******/ | ||
/******/ return __webpack_exports__; | ||
/******/ })() | ||
; | ||
}); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.parsegraph_color=n():t.parsegraph_color=n()}(this,(function(){return(()=>{"use strict";var t={d:(n,r)=>{for(var o in r)t.o(r,o)&&!t.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:r[o]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{clamp:()=>r,default:()=>i,mix:()=>o});var r=function(t,n,r){return Math.min(r,Math.max(n,t))},o=function(t,n,r){return t+(n-t)*r},e=function(){function t(t,n,r,o){if(1===arguments.length)n=t,r=t,o=1;else if(3===arguments.length)o=1;else if(4!==arguments.length)throw new Error("Color must be given initial component values.");this._r=Math.min(1,Math.max(0,t)),this._g=Math.min(1,Math.max(0,n)),this._b=Math.min(1,Math.max(0,r)),this._a=Math.min(1,Math.max(0,o))}return t.prototype.r=function(){return this._r},t.prototype.g=function(){return this._g},t.prototype.b=function(){return this._b},t.prototype.a=function(){return this._a},t.prototype.setA=function(t){return this._a=Math.min(1,Math.max(0,t)),this},t.prototype.setR=function(t){return this._r=Math.min(1,Math.max(0,t)),this},t.prototype.setG=function(t){return this._g=Math.min(1,Math.max(0,t)),this},t.prototype.setB=function(t){return this._b=Math.min(1,Math.max(0,t)),this},t.prototype.multiply=function(n){return new t(this.r()*n.r(),this.g()*n.g(),this.b()*n.b(),this.a()*n.a())},t.prototype.premultiply=function(n){return new t(this.a()*this.r()+n.r()*(1-this.a()),this.a()*this.g()+n.g()*(1-this.a()),this.a()*this.b()+n.b()*(1-this.a()),1)},t.prototype.asRGB=function(){return"rgb("+Math.round(255*this._r)+", "+Math.round(255*this._g)+", "+Math.round(255*this._b)+")"},t.prototype.asRGBA=function(){return"rgba("+Math.round(255*this._r)+", "+Math.round(255*this._g)+", "+Math.round(255*this._b)+", "+Math.round(255*this._a)+")"},t.prototype.luminance=function(){return.648431*t.inverseSRGBCompanding(this.r())+.321152*t.inverseSRGBCompanding(this.g())+.155886*t.inverseSRGBCompanding(this.b())},t.prototype.toLCH=function(){var n,r,o,e,i=t.inverseSRGBCompanding(this.r()),a=t.inverseSRGBCompanding(this.g()),h=t.inverseSRGBCompanding(this.b());return o=[.96422,1,.82521],n=[116*(e=[i,a,h].map((function(t,n){return t/o[n]})).map((function(t){return t>.008856451679035631?Math.cbrt(t):(903.2962962962963*t+16)/116})))[1]-16,500*(e[0]-e[1]),200*(e[1]-e[2])],r=180*Math.atan2(n[2],n[1])/Math.PI,[n[0],Math.sqrt(Math.pow(n[1],2)+Math.pow(n[2],2)),r>=0?r:r+360]},t.prototype.interpolate=function(n,e){e=r(e,0,1);var i=this.toLCH(),a=i[0],h=i[1],s=i[2],u=n.toLCH(),p=u[0],m=u[1],f=u[2],c=o(a,p,e),M=o(h,m,e),g=o(s,f,e);return t.fromLCH(c,M,g,o(this.a(),n.a(),e))},t.prototype.clone=function(){return new t(this.r(),this.g(),this.b(),this.a())},t.prototype.equals=function(t){return this.r()===t.r()&&this.g()===t.g()&&this.b()===t.b()&&this.a()===t.a()},t.fromLCH=function(n,r,o,e){var i,a,h,s,u,p,m=(i=[(p=[n,r,o])[0],p[1]*Math.cos(p[2]*Math.PI/180),p[1]*Math.sin(p[2]*Math.PI/180)],a=24389/27,h=216/24389,s=[.96422,1,.82521],(u=[])[1]=(i[0]+16)/116,u[0]=i[1]/500+u[1],u[2]=u[1]-i[2]/200,[Math.pow(u[0],3)>h?Math.pow(u[0],3):(116*u[0]-16)/a,i[0]>8?Math.pow((i[0]+16)/116,3):i[0]/a,Math.pow(u[2],3)>h?Math.pow(u[2],3):(116*u[2]-16)/a].map((function(t,n){return t*s[n]}))),f=m[0],c=m[1],M=m[2];return new t(t.sRGBCompanding(f),t.sRGBCompanding(c),t.sRGBCompanding(M),e)},t.inverseSRGBCompanding=function(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},t.sRGBCompanding=function(t){return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055},t.fromRGB=function(n,r){1===arguments.length&&(r=255);var o=[];if(n.trim().substring("rgb(".length,n.length-1).split(",").forEach((function(t){o.push(parseInt(t.trim()))})),o.length<3)throw new Error("Failed to parse color");return 3===o.length&&o.push(r),new t(o[0]/255,o[1]/255,o[2]/255,o[3]/255)},t.random=function(n,r){void 0===n&&(n=1),void 0===r&&(r=1);var o=1-(n=Math.min(Math.max(0,n),1));return new t(n*Math.random()+o/2,n*Math.random()+o/2,n*Math.random()+o/2,r)},t}();const i=e;return n})()})); |
{ | ||
"name": "parsegraph-color", | ||
"version": "1.4.7-dev", | ||
"version": "1.4.7", | ||
"description": "color", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
12740
20
63