UNPKG

@devlander/colors

Version:

Color utility package used between packages

3 lines (2 loc) 27.9 kB
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).DevlanderColors={})}(this,(function(r){"use strict";function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function t(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,l(n.key),n)}}function n(r,e,t){return(e=l(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function o(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function a(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){n(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function i(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var n,o,a,i,l=[],u=!0,g=!1;try{if(a=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=a.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(r){g=!0,o=r}finally{try{if(!u&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(g)throw o}}return l}}(r,t)||function(r,t){if(r){if("string"==typeof r)return e(r,t);var n={}.toString.call(r).slice(8,-1);return"Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n?Array.from(r):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(r,t):void 0}}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(r){var e=function(r,e){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var n=t.call(r,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==typeof e?e:e+""}function u(r){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},u(r)}var g=function(r,e){var t;t=e>1?e/100:e;var n=Math.min(Math.max(t,0),1);return a(a({},r),{},{a:n})},b=function(r,e){if(e&&!0===e&&console.log("Testing hex: ".concat(r)),"string"!=typeof r)return!1;var t=/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r);return e&&!0===e&&(console.log("Testing hex: ".concat(r)),console.log("Result for ".concat(r,": ").concat(t))),t};function c(r){var e=r.r,t=r.g,n=r.b,o=r.a;return e<0||e>255||(t<0||t>255||(n<0||n>255||void 0!==o&&(o<0||o>1)))}var h,s=function(r){try{var e=r.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);if(!e)return!1;var t=i(e.map(Number),4);return!c({r:t[1],g:t[2],b:t[3]})}catch(e){return console.error("Error validating RGB string: ".concat(r),e),!1}},f=function(r){try{var e=r.match(/^rgba?\(\s*((?:\d{1,3}%?\s*,\s*){2})(?:\d{1,3}%?\s*,\s*)\d{1,3}%?\s*(?:,\s*([+-]?\d*\.?\d+)\s*)?\)$/);if(!e)return!1;var t=function(r){var e=Number(r.replace("%",""));return r.includes("%")?2.55*e:e};return!c({r:t(e[1].trim()),g:t(e[2].trim()),b:t(e[3].trim()),a:void 0!==e[4]?Number(e[4]):void 0})}catch(e){return console.error("Error validating RGBA string: ".concat(r),e),!1}},d=function(r){return!!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:["transparent"]).includes(r)||(b(r)||s(r)||f(r))},p=function(r,e){var t=Math.abs(e)>1?e/100:e;return{r:Math.min(255,Math.max(0,Math.round(e<0?r.r*(1+e):r.r+t*(255-r.r)))),g:Math.min(255,Math.max(0,Math.round(e<0?r.g*(1+e):r.g+t*(255-r.g)))),b:Math.min(255,Math.max(0,Math.round(e<0?r.b*(1+e):r.b+t*(255-r.b))))}},y=function(r,e){var t=Math.abs(e)>1?e/100:e;return{r:Math.max(0,Math.min(255,Math.round(e<0?r.r-t*(255-r.r):r.r*(1-t)))),g:Math.max(0,Math.min(255,Math.round(e<0?r.g-t*(255-r.g):r.g*(1-t)))),b:Math.max(0,Math.min(255,Math.round(e<0?r.b-t*(255-r.b):r.b*(1-t))))}},m=function(r){var e=function(r){return r.toString(16).padStart(2,"0")};return"#".concat(e(r.r)).concat(e(r.g)).concat(e(r.b)).toUpperCase()},F=function(r){if(void 0!==r.a){var e=Math.round(10*r.a)/10;return"rgba(".concat(r.r,", ").concat(r.g,", ").concat(r.b,", ").concat(e,")")}return"rgb(".concat(r.r,", ").concat(r.g,", ").concat(r.b,")")},v=function(r,e,t){var n;n=Math.abs(t)>1?t/100:t;var o=Math.min(Math.max(n,-1),1);return{r:Math.round(r.r*Math.abs(o)+e.r*(1-Math.abs(o))),g:Math.round(r.g*Math.abs(o)+e.g*(1-Math.abs(o))),b:Math.round(r.b*Math.abs(o)+e.b*(1-Math.abs(o)))}},x=function(r){try{var e=null;if(s(r)){e=/^rgb\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*\)$/.exec(r)}else if(f(r)){e=/^rgba\(\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(\d{1,3}%?)\s*,\s*(0|1|0?\.\d+)\s*\)$/.exec(r)}if(e){var t=i(e.slice(1).map((function(r){return r.endsWith("%")?(e=r,Math.round(2.55*parseFloat(e))):Number(r);var e})),4),n=t[0],o=t[1],a=t[2],l=t[3],u={r:n,g:o,b:a};return void 0!==l&&(u.a=Number(l)),u}return null}catch(r){return console.error("Error parsing RGB string:",r),null}};function w(r,e,t){return e=C(e),function(r,e){if(e&&("object"==u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return M(r)}(r,B()?Reflect.construct(e,t||[],C(r).constructor):e.apply(r,t))}function B(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(r){}return(B=function(){return!!r})()}function D(r){var e=function(r){if("object"!=u(r)||!r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var t=e.call(r,"string");if("object"!=u(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}(r);return"symbol"==u(e)?e:String(e)}function k(r){return k="function"==typeof Symbol&&"symbol"==u(Symbol.iterator)?function(r){return u(r)}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":u(r)},k(r)}function E(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,D(n.key),n)}}function C(r){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},C(r)}function S(r,e){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,e){return r.__proto__=e,r},S(r,e)}function A(r){var e="function"==typeof Map?new Map:void 0;return A=function(r){if(null===r||!function(r){try{return-1!==Function.toString.call(r).indexOf("[native code]")}catch(e){return"function"==typeof r}}(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return function(r,e,t){if(B())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(r.bind.apply(r,n));return t&&S(o,t.prototype),o}(r,arguments,C(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),S(t,r)},A(r)}function M(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(h={}).NONE="",h.K="K",h.M="M",h.B="B",h.T="T",h.P="P",h.E="E";!function(){function r(e,t,n){var o;return function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),o=w(this,r,[e]),Error.captureStackTrace?Error.captureStackTrace(M(o),o.constructor):o.stack=(new Error).stack,o.name="DevlanderError",t&&(o.code=t),n&&(o.config=n),Object.defineProperty(M(o),"DevlanderError",{value:!0}),o}var e,t;(function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&S(r,e)})(r,A(Error)),e=r,t=[{key:"from",value:function(e,t,n,o){var a=Object.create(r.prototype);return function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o={};if(null==r)return e;var a=r;do{for(var i=Object.getOwnPropertyNames(a),l=i.length-1;l>=0;l--){var u=i[l];n&&!n(u,r,e)||o[u]||(e[u]=a[u],o[u]=!0)}a=Object.getPrototypeOf(a)}while(a&&(!t||t(a))&&a!==Object.prototype)}(e,a,(function(r){return r!==Error.prototype}),(function(r){return"DevlanderError"!==r})),r.call(a,e.message,t,n),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a}}],null&&E(e.prototype,null),t&&E(e,t),Object.defineProperty(e,"prototype",{writable:!1})}();var G=function(r){return function(e){return k(e)===r}};!function(r){r["4:3"]="4:3",r["16:9"]="16:9",r["1:1"]="1:1",r["3:2"]="3:2",r["8:5"]="8:5"}({});var O,P=(O=Object.create(null),function(r){var e=toString.call(r);return O[e]||(O[e]=e.slice(8,-1).toLowerCase())}),R=function(r){return r=r.toLowerCase(),function(e){return P(e)===r}};R("ArrayBuffer"),R("Date"),R("File");var j=G("number"),L=function(r){return"string"==typeof r?""!==r.trim()&&r.trim()===r&&!isNaN(Number(r))&&isFinite(Number(r)):"number"==typeof r?!isNaN(r)&&isFinite(r):j(r)};var T={exports:{}},I=String,q=function(){return{isColorSupported:!1,reset:I,bold:I,dim:I,italic:I,underline:I,inverse:I,hidden:I,strikethrough:I,black:I,red:I,green:I,yellow:I,blue:I,magenta:I,cyan:I,white:I,gray:I,bgBlack:I,bgRed:I,bgGreen:I,bgYellow:I,bgBlue:I,bgMagenta:I,bgCyan:I,bgWhite:I}};T.exports=q(),T.exports.createColors=q,function(r){r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")&&r.default}(T.exports);var N,W=function(r,e){if("string"!=typeof r)return e&&!0===e&&console.log("Invalid type for hex: ".concat(u(r))),!1;var t=/^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(r);return e&&!0===e&&console.log("Testing hex: ".concat(r,", Result: ").concat(t)),t},V=function(r){if(!r||"string"!=typeof r)throw new Error("Invalid hex color");var e=r.replace(/^#/,"");if(!W("#".concat(e)))throw new Error("Invalid hex color");var t=3===e.length||4===e.length,n=function(r){return r.repeat(2)};if(![3,4,6,8].includes(e.length))throw new Error("Invalid hex color length");return{r:t?n(e.slice(0,1)):r.slice(0,2),g:t?n(r.slice(1,2)):r.slice(2,4),b:t?n(r.slice(2,3)):r.slice(4,6),a:(t?n(r.slice(3,4)):r.slice(6,8))||"ff"}},H=function(r){return parseInt(r,16)},Y=function(r){var e;e=!function(r){return null!==r&&"object"===k(r)}(r)||function(r){return G("string")(r)}(r)?V(r):{r:r.r,g:r.g,b:r.b,a:"a"in r?r.a:"ff"};var t=e,n=t.r,o=t.g,a=t.b,i=t.a,l={r:H(n),g:H(o),b:H(a)};return l.a=void 0!==i&&"ff"!==i?+(H(i)/255).toFixed(2):1,_(l)},_=function(r){return["r","g","b","a"].forEach((function(e){void 0!==r[e]&&isNaN(r[e])&&(r[e]=1)})),r},$=["transparent"],K=function(r){"undefined"!=typeof console&&"function"==typeof console.log&&console.log(r)},z=function(r,e,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$;try{if(n.includes(r))return r;if(e<0||e>100)return K("Alpha value should be between 0.0 and 1.0. Returning default color."),"#FF0000";if(d(r)){var o=null;if(b(r)){var a=V(r);o=Y(a)}else if(s(r))o=x(r);else{if(!f(r))throw new Error("Invalid color format");o=x(r)}if(!o)throw new Error("Failed to parse color");var i="light"===t?.2:-.2;o="light"===t?p(o,i):y(o,i);var l=e;if(b(r)){var u=v(o,{r:255,g:255,b:255},l);return m(u)}var c=g(o,l);return F(c)}return K("Failed to convert ".concat(r," into a color. Returning default color.")),"#FF0000"}catch(e){return e instanceof Error?K("Error adjusting color with value: ".concat(r,". Returning default color. Error: ").concat(e.message)):K("Error adjusting color with value: ".concat(r,". Returning default color. Unknown error.")),"#FF0000"}},U=function(){return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}((function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"light";if(function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.mode=t,"string"==typeof e){var n=e.replace("#","");this.color={r:H(n.substring(0,2)),g:H(n.substring(2,4)),b:H(n.substring(4,6))},8===n.length&&(this.color.a=+(H(n.substring(6,8))/255).toFixed(2))}else this.color=e}),[{key:"darken",value:function(r){return this.color=y(this.color,r),this}},{key:"lighten",value:function(r){return this.color=p(this.color,r),this}},{key:"rgb",value:function(){return F(this.color)}},{key:"hex",value:function(){return m(this.color)}},{key:"invert",value:function(){return this.mode="light"===this.mode?"dark":"light",z(this.hex(),1,this.mode)}},{key:"alpha",value:function(r){return this.color=g(this.color,r),this.color}},{key:"blend",value:function(r,e){return this.color=v(this.color,e,r),this}},{key:"getColor",value:function(){return this.color}}])}(),X=function(r){return r.AliceBlue="aliceblue",r.AntiqueWhite="antiquewhite",r.Aqua="aqua",r.Aquamarine="aquamarine",r.Azure="azure",r.Beige="beige",r.Bisque="bisque",r.Black="black",r.BlanchedAlmond="blanchedalmond",r.Blue="blue",r.BlueViolet="blueviolet",r.Brown="brown",r.BurlyWood="burlywood",r.CadetBlue="cadetblue",r.Chartreuse="chartreuse",r.Chocolate="chocolate",r.Coral="coral",r.CornflowerBlue="cornflowerblue",r.Cornsilk="cornsilk",r.Crimson="crimson",r.Cyan="cyan",r.DarkBlue="darkblue",r.DarkCyan="darkcyan",r.DarkGoldenRod="darkgoldenrod",r.DarkGray="darkgray",r.DarkGreen="darkgreen",r.DarkGrey="darkgrey",r.DarkKhaki="darkkhaki",r.DarkMagenta="darkmagenta",r.DarkOliveGreen="darkolivegreen",r.DarkOrange="darkorange",r.DarkOrchid="darkorchid",r.DarkRed="darkred",r.DarkSalmon="darksalmon",r.DarkSeaGreen="darkseagreen",r.DarkSlateBlue="darkslateblue",r.DarkSlateGray="darkslategray",r.DarkTurquoise="darkturquoise",r.DarkViolet="darkviolet",r.DeepPink="deeppink",r.DeepSkyBlue="deepskyblue",r.DimGray="dimgray",r.DimGrey="dimgrey",r.DodgerBlue="dodgerblue",r.FireBrick="firebrick",r.FloralWhite="floralwhite",r.ForestGreen="forestgreen",r.Fuchsia="fuchsia",r.Gainsboro="gainsboro",r.GhostWhite="ghostwhite",r.Gold="gold",r.GoldenRod="goldenrod",r.Gray="gray",r.Green="green",r.GreenYellow="greenyellow",r.HoneyDew="honeydew",r.HotPink="hotpink",r.IndianRed="indianred",r.Indigo="indigo",r.Ivory="ivory",r.Khaki="khaki",r.Lavender="lavender",r.LavenderBlush="lavenderblush",r.LawnGreen="lawngreen",r.LemonChiffon="lemonchiffon",r.LightBlue="lightblue",r.LightCoral="lightcoral",r.LightCyan="lightcyan",r.LightGoldenRodYellow="lightgoldenrodyellow",r.LightGray="lightgray",r.LightGreen="lightgreen",r.LightGrey="lightgrey",r.LightPink="lightpink",r.LightSalmon="lightsalmon",r.LightSeaGreen="lightseagreen",r.LightSkyBlue="lightskyblue",r.LightSlateGray="lightslategray",r.LightSteelBlue="lightsteelblue",r.LightYellow="lightyellow",r.Lime="lime",r.LimeGreen="limegreen",r.Linen="linen",r.Magenta="magenta",r.Maroon="maroon",r.MediumAquaMarine="mediumaquamarine",r.MediumBlue="mediumblue",r.MediumOrchid="mediumorchid",r.MediumPurple="mediumpurple",r.MediumSeaGreen="mediumseagreen",r.MediumSlateBlue="mediumslateblue",r.MediumSpringGreen="mediumspringgreen",r.MediumTurquoise="mediumturquoise",r.MediumVioletRed="mediumvioletred",r.MidnightBlue="midnightblue",r.MintCream="mintcream",r.MistyRose="mistyrose",r.Moccasin="moccasin",r.NavajoWhite="navajowhite",r.Navy="navy",r.OldLace="oldlace",r.Olive="olive",r.OliveDrab="olivedrab",r.Orange="orange",r.OrangeRed="orangered",r.Orchid="orchid",r.PaleGoldenRod="palegoldenrod",r.PaleGreen="palegreen",r.PaleTurquoise="paleturquoise",r.PaleVioletRed="palevioletred",r.PapayaWhip="papayawhip",r.PeachPuff="peachpuff",r.Peru="peru",r.Pink="pink",r.Plum="plum",r.PowderBlue="powderblue",r.Purple="purple",r.RebeccaPurple="rebeccapurple",r.Red="red",r.RosyBrown="rosybrown",r.RoyalBlue="royalblue",r.SaddleBrown="saddlebrown",r.Salmon="salmon",r.SandyBrown="sandybrown",r.SeaGreen="seagreen",r.SeaShell="seashell",r.Sienna="sienna",r.Silver="silver",r.SkyBlue="skyblue",r.SlateBlue="slateblue",r.SlateGray="slategray",r.Snow="snow",r.SpringGreen="springgreen",r.SteelBlue="steelblue",r.Tan="tan",r.Teal="teal",r.Thistle="thistle",r.Tomato="tomato",r.Turquoise="turquoise",r.Violet="violet",r.Wheat="wheat",r.White="white",r.WhiteSmoke="whitesmoke",r.Yellow="yellow",r.YellowGreen="yellowgreen",r}({}),J=(n(n(n(n(n(n(n(n(n(n(N={},X.AliceBlue,{rgb:{r:240,g:248,b:255},hex:"#F0F8FF"}),X.AntiqueWhite,{rgb:{r:250,g:235,b:215},hex:"#FAEBD7"}),X.Aqua,{rgb:{r:0,g:255,b:255},hex:"#00FFFF"}),X.Aquamarine,{rgb:{r:127,g:255,b:212},hex:"#7FFFD4"}),X.Azure,{rgb:{r:240,g:255,b:255},hex:"#F0FFFF"}),X.Beige,{rgb:{r:245,g:245,b:220},hex:"#F5F5DC"}),X.Bisque,{rgb:{r:255,g:228,b:196},hex:"#FFE4C4"}),X.Black,{rgb:{r:0,g:0,b:0},hex:"#000000"}),X.BlanchedAlmond,{rgb:{r:255,g:235,b:205},hex:"#FFEBCD"}),X.Blue,{rgb:{r:0,g:0,b:255},hex:"#0000FF"}),n(n(n(n(n(n(n(n(n(n(N,X.BlueViolet,{rgb:{r:138,g:43,b:226},hex:"#8A2BE2"}),X.Brown,{rgb:{r:165,g:42,b:42},hex:"#A52A2A"}),X.BurlyWood,{rgb:{r:222,g:184,b:135},hex:"#DEB887"}),X.CadetBlue,{rgb:{r:95,g:158,b:160},hex:"#5F9EA0"}),X.Chartreuse,{rgb:{r:127,g:255,b:0},hex:"#7FFF00"}),X.Chocolate,{rgb:{r:210,g:105,b:30},hex:"#D2691E"}),X.Coral,{rgb:{r:255,g:127,b:80},hex:"#FF7F50"}),X.CornflowerBlue,{rgb:{r:100,g:149,b:237},hex:"#6495ED"}),X.Cornsilk,{rgb:{r:255,g:248,b:220},hex:"#FFF8DC"}),X.Crimson,{rgb:{r:220,g:20,b:60},hex:"#DC143C"}),n(n(n(n(n(n(n(n(n(n(N,X.Cyan,{rgb:{r:0,g:255,b:255},hex:"#00FFFF"}),X.DarkBlue,{rgb:{r:0,g:0,b:139},hex:"#00008B"}),X.DarkCyan,{rgb:{r:0,g:139,b:139},hex:"#008B8B"}),X.DarkGoldenRod,{rgb:{r:184,g:134,b:11},hex:"#B8860B"}),X.DarkGray,{rgb:{r:169,g:169,b:169},hex:"#A9A9A9"}),X.DarkGreen,{rgb:{r:0,g:100,b:0},hex:"#006400"}),X.DarkGrey,{rgb:{r:169,g:169,b:169},hex:"#A9A9A9"}),X.DarkKhaki,{rgb:{r:189,g:183,b:107},hex:"#BDB76B"}),X.DarkMagenta,{rgb:{r:139,g:0,b:139},hex:"#8B008B"}),X.DarkOliveGreen,{rgb:{r:85,g:107,b:47},hex:"#556B2F"}),n(n(n(n(n(n(n(n(n(n(N,X.DarkOrange,{rgb:{r:255,g:140,b:0},hex:"#FF8C00"}),X.DarkOrchid,{rgb:{r:153,g:50,b:204},hex:"#9932CC"}),X.DarkRed,{rgb:{r:139,g:0,b:0},hex:"#8B0000"}),X.DarkSalmon,{rgb:{r:233,g:150,b:122},hex:"#E9967A"}),X.DarkSeaGreen,{rgb:{r:143,g:188,b:143},hex:"#8FBC8F"}),X.DarkSlateBlue,{rgb:{r:72,g:61,b:139},hex:"#483D8B"}),X.DarkSlateGray,{rgb:{r:47,g:79,b:79},hex:"#2F4F4F"}),X.DarkTurquoise,{rgb:{r:0,g:206,b:209},hex:"#00CED1"}),X.DarkViolet,{rgb:{r:148,g:0,b:211},hex:"#9400D3"}),X.DeepPink,{rgb:{r:255,g:20,b:147},hex:"#FF1493"}),n(n(n(n(n(n(n(n(n(n(N,X.DeepSkyBlue,{rgb:{r:0,g:191,b:255},hex:"#00BFFF"}),X.DimGray,{rgb:{r:105,g:105,b:105},hex:"#696969"}),X.DimGrey,{rgb:{r:105,g:105,b:105},hex:"#696969"}),X.DodgerBlue,{rgb:{r:30,g:144,b:255},hex:"#1E90FF"}),X.FireBrick,{rgb:{r:178,g:34,b:34},hex:"#B22222"}),X.FloralWhite,{rgb:{r:255,g:250,b:240},hex:"#FFFAF0"}),X.ForestGreen,{rgb:{r:34,g:139,b:34},hex:"#228B22"}),X.Fuchsia,{rgb:{r:255,g:0,b:255},hex:"#FF00FF"}),X.Gainsboro,{rgb:{r:220,g:220,b:220},hex:"#DCDCDC"}),X.GhostWhite,{rgb:{r:248,g:248,b:255},hex:"#F8F8FF"}),n(n(n(n(n(n(n(n(n(n(N,X.Gold,{rgb:{r:255,g:215,b:0},hex:"#FFD700"}),X.GoldenRod,{rgb:{r:218,g:165,b:32},hex:"#DAA520"}),X.Gray,{rgb:{r:128,g:128,b:128},hex:"#808080"}),X.Green,{rgb:{r:0,g:128,b:0},hex:"#008000"}),X.GreenYellow,{rgb:{r:173,g:255,b:47},hex:"#ADFF2F"}),X.HoneyDew,{rgb:{r:240,g:255,b:240},hex:"#F0FFF0"}),X.HotPink,{rgb:{r:255,g:105,b:180},hex:"#FF69B4"}),X.IndianRed,{rgb:{r:205,g:92,b:92},hex:"#CD5C5C"}),X.Indigo,{rgb:{r:75,g:0,b:130},hex:"#4B0082"}),X.Ivory,{rgb:{r:255,g:255,b:240},hex:"#FFFFF0"}),n(n(n(n(n(n(n(n(n(n(N,X.Khaki,{rgb:{r:240,g:230,b:140},hex:"#F0E68C"}),X.Lavender,{rgb:{r:230,g:230,b:250},hex:"#E6E6FA"}),X.LavenderBlush,{rgb:{r:255,g:240,b:245},hex:"#FFF0F5"}),X.LawnGreen,{rgb:{r:124,g:252,b:0},hex:"#7CFC00"}),X.LemonChiffon,{rgb:{r:255,g:250,b:205},hex:"#FFFACD"}),X.LightBlue,{rgb:{r:173,g:216,b:230},hex:"#ADD8E6"}),X.LightCoral,{rgb:{r:240,g:128,b:128},hex:"#F08080"}),X.LightCyan,{rgb:{r:224,g:255,b:255},hex:"#E0FFFF"}),X.LightGoldenRodYellow,{rgb:{r:250,g:250,b:210},hex:"#FAFAD2"}),X.LightGray,{rgb:{r:211,g:211,b:211},hex:"#D3D3D3"}),n(n(n(n(n(n(n(n(n(n(N,X.LightGreen,{rgb:{r:144,g:238,b:144},hex:"#90EE90"}),X.LightGrey,{rgb:{r:211,g:211,b:211},hex:"#D3D3D3"}),X.LightPink,{rgb:{r:255,g:182,b:193},hex:"#FFB6C1"}),X.LightSalmon,{rgb:{r:255,g:160,b:122},hex:"#FFA07A"}),X.LightSeaGreen,{rgb:{r:32,g:178,b:170},hex:"#20B2AA"}),X.LightSkyBlue,{rgb:{r:135,g:206,b:250},hex:"#87CEFA"}),X.LightSlateGray,{rgb:{r:119,g:136,b:153},hex:"#778899"}),X.LightSteelBlue,{rgb:{r:176,g:196,b:222},hex:"#B0C4DE"}),X.LightYellow,{rgb:{r:255,g:255,b:224},hex:"#FFFFE0"}),X.Lime,{rgb:{r:0,g:255,b:0},hex:"#00FF00"}),n(n(n(n(n(n(n(n(n(n(N,X.LimeGreen,{rgb:{r:50,g:205,b:50},hex:"#32CD32"}),X.Linen,{rgb:{r:250,g:240,b:230},hex:"#FAF0E6"}),X.Magenta,{rgb:{r:255,g:0,b:255},hex:"#FF00FF"}),X.Maroon,{rgb:{r:128,g:0,b:0},hex:"#800000"}),X.MediumAquaMarine,{rgb:{r:102,g:205,b:170},hex:"#66CDAA"}),X.MediumBlue,{rgb:{r:0,g:0,b:205},hex:"#0000CD"}),X.MediumOrchid,{rgb:{r:186,g:85,b:211},hex:"#BA55D3"}),X.MediumPurple,{rgb:{r:147,g:112,b:219},hex:"#9370DB"}),X.MediumSeaGreen,{rgb:{r:60,g:179,b:113},hex:"#3CB371"}),X.MediumSlateBlue,{rgb:{r:123,g:104,b:238},hex:"#7B68EE"}),n(n(n(n(n(n(n(n(n(n(N,X.MediumSpringGreen,{rgb:{r:0,g:250,b:154},hex:"#00FA9A"}),X.MediumTurquoise,{rgb:{r:72,g:209,b:204},hex:"#48D1CC"}),X.MediumVioletRed,{rgb:{r:199,g:21,b:133},hex:"#C71585"}),X.MidnightBlue,{rgb:{r:25,g:25,b:112},hex:"#191970"}),X.MintCream,{rgb:{r:245,g:255,b:250},hex:"#F5FFFA"}),X.MistyRose,{rgb:{r:255,g:228,b:225},hex:"#FFE4E1"}),X.Moccasin,{rgb:{r:255,g:228,b:181},hex:"#FFE4B5"}),X.NavajoWhite,{rgb:{r:255,g:222,b:173},hex:"#FFDEAD"}),X.Navy,{rgb:{r:0,g:0,b:128},hex:"#000080"}),X.OldLace,{rgb:{r:253,g:245,b:230},hex:"#FDF5E6"}),n(n(n(n(n(n(n(n(n(n(N,X.Olive,{rgb:{r:128,g:128,b:0},hex:"#808000"}),X.OliveDrab,{rgb:{r:107,g:142,b:35},hex:"#6B8E23"}),X.Orange,{rgb:{r:255,g:165,b:0},hex:"#FFA500"}),X.OrangeRed,{rgb:{r:255,g:69,b:0},hex:"#FF4500"}),X.Orchid,{rgb:{r:218,g:112,b:214},hex:"#DA70D6"}),X.PaleGoldenRod,{rgb:{r:238,g:232,b:170},hex:"#EEE8AA"}),X.PaleGreen,{rgb:{r:152,g:251,b:152},hex:"#98FB98"}),X.PaleTurquoise,{rgb:{r:175,g:238,b:238},hex:"#AFEEEE"}),X.PaleVioletRed,{rgb:{r:219,g:112,b:147},hex:"#DB7093"}),X.PapayaWhip,{rgb:{r:255,g:239,b:213},hex:"#FFEFD5"}),n(n(n(n(n(n(n(n(n(n(N,X.PeachPuff,{rgb:{r:255,g:218,b:185},hex:"#FFDAB9"}),X.Peru,{rgb:{r:205,g:133,b:63},hex:"#CD853F"}),X.Pink,{rgb:{r:255,g:192,b:203},hex:"#FFC0CB"}),X.Plum,{rgb:{r:221,g:160,b:221},hex:"#DDA0DD"}),X.PowderBlue,{rgb:{r:176,g:224,b:230},hex:"#B0E0E6"}),X.Purple,{rgb:{r:128,g:0,b:128},hex:"#800080"}),X.RebeccaPurple,{rgb:{r:102,g:51,b:153},hex:"#663399"}),X.Red,{rgb:{r:255,g:0,b:0},hex:"#FF0000"}),X.RosyBrown,{rgb:{r:188,g:143,b:143},hex:"#BC8F8F"}),X.RoyalBlue,{rgb:{r:65,g:105,b:225},hex:"#4169E1"}),n(n(n(n(n(n(n(n(n(n(N,X.SaddleBrown,{rgb:{r:139,g:69,b:19},hex:"#8B4513"}),X.Salmon,{rgb:{r:250,g:128,b:114},hex:"#FA8072"}),X.SandyBrown,{rgb:{r:244,g:164,b:96},hex:"#F4A460"}),X.SeaGreen,{rgb:{r:46,g:139,b:87},hex:"#2E8B57"}),X.SeaShell,{rgb:{r:255,g:245,b:238},hex:"#FFF5EE"}),X.Sienna,{rgb:{r:160,g:82,b:45},hex:"#A0522D"}),X.Silver,{rgb:{r:192,g:192,b:192},hex:"#C0C0C0"}),X.SkyBlue,{rgb:{r:135,g:206,b:235},hex:"#87CEEB"}),X.SlateBlue,{rgb:{r:106,g:90,b:205},hex:"#6A5ACD"}),X.SlateGray,{rgb:{r:112,g:128,b:144},hex:"#708090"}),n(n(n(n(n(n(n(n(n(n(N,X.Snow,{rgb:{r:255,g:250,b:250},hex:"#FFFAFA"}),X.SpringGreen,{rgb:{r:0,g:255,b:127},hex:"#00FF7F"}),X.SteelBlue,{rgb:{r:70,g:130,b:180},hex:"#4682B4"}),X.Tan,{rgb:{r:210,g:180,b:140},hex:"#D2B48C"}),X.Teal,{rgb:{r:0,g:128,b:128},hex:"#008080"}),X.Thistle,{rgb:{r:216,g:191,b:216},hex:"#D8BFD8"}),X.Tomato,{rgb:{r:255,g:99,b:71},hex:"#FF6347"}),X.Turquoise,{rgb:{r:64,g:224,b:208},hex:"#40E0D0"}),X.Violet,{rgb:{r:238,g:130,b:238},hex:"#EE82EE"}),X.Wheat,{rgb:{r:245,g:222,b:179},hex:"#F5DEB3"}),n(n(n(n(N,X.White,{rgb:{r:255,g:255,b:255},hex:"#FFFFFF"}),X.WhiteSmoke,{rgb:{r:245,g:245,b:245},hex:"#F5F5F5"}),X.Yellow,{rgb:{r:255,g:255,b:0},hex:"#FFFF00"}),X.YellowGreen,{rgb:{r:154,g:205,b:50},hex:"#9ACD32"}));function Q(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!b(r))throw new Error("Invalid hex color");var t=r.replace(/^#/,""),n=V(t),o=n.r,a=n.g,i=n.b;if(!o||!a||!i||2!==o.length||2!==a.length||2!==i.length)throw new TypeError("Invalid color components");var l,u=H(o),g=H(a),c=H(i);if("number"==typeof e){if(e<0||e>1)throw new Error("Invalid alpha value");l=e}else if(L(e)){if((l=parseFloat(e))<0||l>1)throw new Error("Invalid alpha value")}else l=1;return F({r:u,g:g,b:c,a:l})}r.Color=U,r.ColorNames=X,r.RGBAToHexAlpha=function(r){var e,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null===(e=r.match(/\d+\.?\d*/g))||void 0===e?void 0:e.map(Number);if(!n)throw new Error("Invalid RGBA/RGB input");var o=n.map((function(r,e){3===e&&(r=Math.round(255*r));var t=r.toString(16);return 1===t.length?"0"+t:t}));return t&&4===o.length&&o.pop(),"#"+o.join("")},r.adjustColor=z,r.applyAlphaToColor=g,r.blendColors=v,r.canBeConvertedIntoColor=d,r.cssColors=J,r.darkenColor=y,r.darkenColorByShade=function(r,e){var t=function(r){return/^#([A-Fa-f0-9]{3}){1,2}$/.test(r)};if(!r||"number"!=typeof e)throw new Error("Both color and amount are required");if(e<0)throw new Error("Amount must be a positive number");var n=t(r)?function(r){if(!t(r))throw new Error("Invalid HEX format");var e=r.substring(1).split("");3===e.length&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]]);var n=parseInt(e.join(""),16);return[n>>16&255,n>>8&255,255&n]}(r):function(r){var e=r.match(/\d+/g);if(!e||e.length<3)throw new Error("Invalid RGB format");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)]}(r);return function(r,e){var t=i(r.map((function(r){return Math.max(0,r-e)})),3),n=t[0],o=t[1],a=t[2];return"rgba(".concat(n,", ").concat(o,", ").concat(a,", 1)")}(n,e)},r.formatDecimalObjectToRgba=function(r,e){try{var t=r.r,n=r.g,o=r.b,a=r.a,i=void 0!==e&&L(e)?Math.round(10*parseFloat(e))/10:a;return F({r:t,g:n,b:o,a:i})}catch(r){return console.error("Error formatting decimal object to RGBA string:",r),F({r:0,g:0,b:0,a:1})}},r.hexToDecimal=H,r.hexToRgb=function(r){if(!b(r))throw new Error("Invalid hex color");r="#"===r.charAt(0)?r.slice(1):r;var e=parseInt(r,16),t=e>>16&255,n=e>>8&255,o=255&e;return 8===r.length?Q(r,(e>>24&255)/255):F({r:t,g:n,b:o})},r.hexToRgba=Q,r.hexesToDecimals=Y,r.hslToRgb=function(r,e,t){e/=100,t/=100;var n=(1-Math.abs(2*t-1))*e,o=n*(1-Math.abs(r/60%2-1)),a=t-n/2,i=0,l=0,u=0;return 0<=r&&r<60?(i=n,l=o,u=0):60<=r&&r<120?(i=o,l=n,u=0):120<=r&&r<180?(i=0,l=n,u=o):180<=r&&r<240?(i=0,l=o,u=n):240<=r&&r<300?(i=o,l=0,u=n):300<=r&&r<360&&(i=n,l=0,u=o),[i=Math.round(255*(i+a)),l=Math.round(255*(l+a)),u=Math.round(255*(u+a))]},r.isHexColor=W,r.isRgbaOutOfRange=c,r.isValidAlphaHexCode=function(r){return/^#([A-Fa-f0-9]{8})$/.test(r)},r.isValidHex=b,r.isValidRgb=s,r.isValidRgba=f,r.lightenColor=p,r.logFromPackage=K,r.parseColor=function(r){if(!d(r))throw new Error("Invalid color format");try{var e=null;if(b(r)){var t=V(r);e=Y(t)}else if(s(r)){e=x(r)}else if(f(r)){e=x(r)}return e?c(e)?{r:0,g:0,b:0,a:1}:e:{r:0,g:0,b:0,a:1}}catch(e){return console.error("Error parsing color value: ".concat(r),e),{r:0,g:0,b:0,a:1}}},r.parseHex=V,r.parseRgbString=x,r.toHexColor=m,r.toRgbString=F})); //# sourceMappingURL=index.js.map