c9ee51774872218f1af5b41796fa8985.json
53.9 KB
{"ast":null,"code":"import { rgbaToHex, rgbToHex, rgbToHsl, rgbToHsv, numberInputToObject } from './conversion';\nimport { names } from './css-color-names';\nimport { inputToRGB } from './format-input';\nimport { bound01, boundAlpha, clamp01 } from './util';\n\nvar TinyColor =\n/** @class */\nfunction () {\n function TinyColor(color, opts) {\n if (color === void 0) {\n color = '';\n }\n\n if (opts === void 0) {\n opts = {};\n }\n\n var _a; // If input is already a tinycolor, return itself\n\n\n if (color instanceof TinyColor) {\n // eslint-disable-next-line no-constructor-return\n return color;\n }\n\n if (typeof color === 'number') {\n color = numberInputToObject(color);\n }\n\n this.originalInput = color;\n var rgb = inputToRGB(color);\n this.originalInput = color;\n this.r = rgb.r;\n this.g = rgb.g;\n this.b = rgb.b;\n this.a = rgb.a;\n this.roundA = Math.round(100 * this.a) / 100;\n this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;\n this.gradientType = opts.gradientType; // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n\n if (this.r < 1) {\n this.r = Math.round(this.r);\n }\n\n if (this.g < 1) {\n this.g = Math.round(this.g);\n }\n\n if (this.b < 1) {\n this.b = Math.round(this.b);\n }\n\n this.isValid = rgb.ok;\n }\n\n TinyColor.prototype.isDark = function () {\n return this.getBrightness() < 128;\n };\n\n TinyColor.prototype.isLight = function () {\n return !this.isDark();\n };\n /**\n * Returns the perceived brightness of the color, from 0-255.\n */\n\n\n TinyColor.prototype.getBrightness = function () {\n // http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n };\n /**\n * Returns the perceived luminance of a color, from 0-1.\n */\n\n\n TinyColor.prototype.getLuminance = function () {\n // http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var R;\n var G;\n var B;\n var RsRGB = rgb.r / 255;\n var GsRGB = rgb.g / 255;\n var BsRGB = rgb.b / 255;\n\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n // eslint-disable-next-line prefer-exponentiation-operator\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n // eslint-disable-next-line prefer-exponentiation-operator\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n } else {\n // eslint-disable-next-line prefer-exponentiation-operator\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n\n return 0.2126 * R + 0.7152 * G + 0.0722 * B;\n };\n /**\n * Returns the alpha value of a color, from 0-1.\n */\n\n\n TinyColor.prototype.getAlpha = function () {\n return this.a;\n };\n /**\n * Sets the alpha value on the current color.\n *\n * @param alpha - The new alpha value. The accepted range is 0-1.\n */\n\n\n TinyColor.prototype.setAlpha = function (alpha) {\n this.a = boundAlpha(alpha);\n this.roundA = Math.round(100 * this.a) / 100;\n return this;\n };\n /**\n * Returns the object as a HSVA object.\n */\n\n\n TinyColor.prototype.toHsv = function () {\n var hsv = rgbToHsv(this.r, this.g, this.b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v,\n a: this.a\n };\n };\n /**\n * Returns the hsva values interpolated into a string with the following format:\n * \"hsva(xxx, xxx, xxx, xx)\".\n */\n\n\n TinyColor.prototype.toHsvString = function () {\n var hsv = rgbToHsv(this.r, this.g, this.b);\n var h = Math.round(hsv.h * 360);\n var s = Math.round(hsv.s * 100);\n var v = Math.round(hsv.v * 100);\n return this.a === 1 ? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" : \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + this.roundA + \")\";\n };\n /**\n * Returns the object as a HSLA object.\n */\n\n\n TinyColor.prototype.toHsl = function () {\n var hsl = rgbToHsl(this.r, this.g, this.b);\n return {\n h: hsl.h * 360,\n s: hsl.s,\n l: hsl.l,\n a: this.a\n };\n };\n /**\n * Returns the hsla values interpolated into a string with the following format:\n * \"hsla(xxx, xxx, xxx, xx)\".\n */\n\n\n TinyColor.prototype.toHslString = function () {\n var hsl = rgbToHsl(this.r, this.g, this.b);\n var h = Math.round(hsl.h * 360);\n var s = Math.round(hsl.s * 100);\n var l = Math.round(hsl.l * 100);\n return this.a === 1 ? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" : \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + this.roundA + \")\";\n };\n /**\n * Returns the hex value of the color.\n * @param allow3Char will shorten hex value to 3 char if possible\n */\n\n\n TinyColor.prototype.toHex = function (allow3Char) {\n if (allow3Char === void 0) {\n allow3Char = false;\n }\n\n return rgbToHex(this.r, this.g, this.b, allow3Char);\n };\n /**\n * Returns the hex value of the color -with a # appened.\n * @param allow3Char will shorten hex value to 3 char if possible\n */\n\n\n TinyColor.prototype.toHexString = function (allow3Char) {\n if (allow3Char === void 0) {\n allow3Char = false;\n }\n\n return '#' + this.toHex(allow3Char);\n };\n /**\n * Returns the hex 8 value of the color.\n * @param allow4Char will shorten hex value to 4 char if possible\n */\n\n\n TinyColor.prototype.toHex8 = function (allow4Char) {\n if (allow4Char === void 0) {\n allow4Char = false;\n }\n\n return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);\n };\n /**\n * Returns the hex 8 value of the color -with a # appened.\n * @param allow4Char will shorten hex value to 4 char if possible\n */\n\n\n TinyColor.prototype.toHex8String = function (allow4Char) {\n if (allow4Char === void 0) {\n allow4Char = false;\n }\n\n return '#' + this.toHex8(allow4Char);\n };\n /**\n * Returns the object as a RGBA object.\n */\n\n\n TinyColor.prototype.toRgb = function () {\n return {\n r: Math.round(this.r),\n g: Math.round(this.g),\n b: Math.round(this.b),\n a: this.a\n };\n };\n /**\n * Returns the RGBA values interpolated into a string with the following format:\n * \"RGBA(xxx, xxx, xxx, xx)\".\n */\n\n\n TinyColor.prototype.toRgbString = function () {\n var r = Math.round(this.r);\n var g = Math.round(this.g);\n var b = Math.round(this.b);\n return this.a === 1 ? \"rgb(\" + r + \", \" + g + \", \" + b + \")\" : \"rgba(\" + r + \", \" + g + \", \" + b + \", \" + this.roundA + \")\";\n };\n /**\n * Returns the object as a RGBA object.\n */\n\n\n TinyColor.prototype.toPercentageRgb = function () {\n var fmt = function (x) {\n return Math.round(bound01(x, 255) * 100) + \"%\";\n };\n\n return {\n r: fmt(this.r),\n g: fmt(this.g),\n b: fmt(this.b),\n a: this.a\n };\n };\n /**\n * Returns the RGBA relative values interpolated into a string\n */\n\n\n TinyColor.prototype.toPercentageRgbString = function () {\n var rnd = function (x) {\n return Math.round(bound01(x, 255) * 100);\n };\n\n return this.a === 1 ? \"rgb(\" + rnd(this.r) + \"%, \" + rnd(this.g) + \"%, \" + rnd(this.b) + \"%)\" : \"rgba(\" + rnd(this.r) + \"%, \" + rnd(this.g) + \"%, \" + rnd(this.b) + \"%, \" + this.roundA + \")\";\n };\n /**\n * The 'real' name of the color -if there is one.\n */\n\n\n TinyColor.prototype.toName = function () {\n if (this.a === 0) {\n return 'transparent';\n }\n\n if (this.a < 1) {\n return false;\n }\n\n var hex = '#' + rgbToHex(this.r, this.g, this.b, false);\n\n for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {\n var _b = _a[_i],\n key = _b[0],\n value = _b[1];\n\n if (hex === value) {\n return key;\n }\n }\n\n return false;\n };\n /**\n * String representation of the color.\n *\n * @param format - The format to be used when displaying the string representation.\n */\n\n\n TinyColor.prototype.toString = function (format) {\n var formatSet = Boolean(format);\n format = format !== null && format !== void 0 ? format : this.format;\n var formattedString = false;\n var hasAlpha = this.a < 1 && this.a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith('hex') || format === 'name');\n\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === 'name' && this.a === 0) {\n return this.toName();\n }\n\n return this.toRgbString();\n }\n\n if (format === 'rgb') {\n formattedString = this.toRgbString();\n }\n\n if (format === 'prgb') {\n formattedString = this.toPercentageRgbString();\n }\n\n if (format === 'hex' || format === 'hex6') {\n formattedString = this.toHexString();\n }\n\n if (format === 'hex3') {\n formattedString = this.toHexString(true);\n }\n\n if (format === 'hex4') {\n formattedString = this.toHex8String(true);\n }\n\n if (format === 'hex8') {\n formattedString = this.toHex8String();\n }\n\n if (format === 'name') {\n formattedString = this.toName();\n }\n\n if (format === 'hsl') {\n formattedString = this.toHslString();\n }\n\n if (format === 'hsv') {\n formattedString = this.toHsvString();\n }\n\n return formattedString || this.toHexString();\n };\n\n TinyColor.prototype.toNumber = function () {\n return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);\n };\n\n TinyColor.prototype.clone = function () {\n return new TinyColor(this.toString());\n };\n /**\n * Lighten the color a given amount. Providing 100 will always return white.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.lighten = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n var hsl = this.toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return new TinyColor(hsl);\n };\n /**\n * Brighten the color a given amount, from 0 to 100.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.brighten = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n var rgb = this.toRgb();\n rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));\n rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));\n rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));\n return new TinyColor(rgb);\n };\n /**\n * Darken the color a given amount, from 0 to 100.\n * Providing 100 will always return black.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.darken = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n var hsl = this.toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return new TinyColor(hsl);\n };\n /**\n * Mix the color with pure white, from 0 to 100.\n * Providing 0 will do nothing, providing 100 will always return white.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.tint = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n return this.mix('white', amount);\n };\n /**\n * Mix the color with pure black, from 0 to 100.\n * Providing 0 will do nothing, providing 100 will always return black.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.shade = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n return this.mix('black', amount);\n };\n /**\n * Desaturate the color a given amount, from 0 to 100.\n * Providing 100 will is the same as calling greyscale\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.desaturate = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n var hsl = this.toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return new TinyColor(hsl);\n };\n /**\n * Saturate the color a given amount, from 0 to 100.\n * @param amount - valid between 1-100\n */\n\n\n TinyColor.prototype.saturate = function (amount) {\n if (amount === void 0) {\n amount = 10;\n }\n\n var hsl = this.toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return new TinyColor(hsl);\n };\n /**\n * Completely desaturates a color into greyscale.\n * Same as calling `desaturate(100)`\n */\n\n\n TinyColor.prototype.greyscale = function () {\n return this.desaturate(100);\n };\n /**\n * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n * Values outside of this range will be wrapped into this range.\n */\n\n\n TinyColor.prototype.spin = function (amount) {\n var hsl = this.toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return new TinyColor(hsl);\n };\n /**\n * Mix the current color a given amount with another color, from 0 to 100.\n * 0 means no mixing (return current color).\n */\n\n\n TinyColor.prototype.mix = function (color, amount) {\n if (amount === void 0) {\n amount = 50;\n }\n\n var rgb1 = this.toRgb();\n var rgb2 = new TinyColor(color).toRgb();\n var p = amount / 100;\n var rgba = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b,\n a: (rgb2.a - rgb1.a) * p + rgb1.a\n };\n return new TinyColor(rgba);\n };\n\n TinyColor.prototype.analogous = function (results, slices) {\n if (results === void 0) {\n results = 6;\n }\n\n if (slices === void 0) {\n slices = 30;\n }\n\n var hsl = this.toHsl();\n var part = 360 / slices;\n var ret = [this];\n\n for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(new TinyColor(hsl));\n }\n\n return ret;\n };\n /**\n * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js\n */\n\n\n TinyColor.prototype.complement = function () {\n var hsl = this.toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return new TinyColor(hsl);\n };\n\n TinyColor.prototype.monochromatic = function (results) {\n if (results === void 0) {\n results = 6;\n }\n\n var hsv = this.toHsv();\n var h = hsv.h;\n var s = hsv.s;\n var v = hsv.v;\n var res = [];\n var modification = 1 / results;\n\n while (results--) {\n res.push(new TinyColor({\n h: h,\n s: s,\n v: v\n }));\n v = (v + modification) % 1;\n }\n\n return res;\n };\n\n TinyColor.prototype.splitcomplement = function () {\n var hsl = this.toHsl();\n var h = hsl.h;\n return [this, new TinyColor({\n h: (h + 72) % 360,\n s: hsl.s,\n l: hsl.l\n }), new TinyColor({\n h: (h + 216) % 360,\n s: hsl.s,\n l: hsl.l\n })];\n };\n /**\n * Compute how the color would appear on a background\n */\n\n\n TinyColor.prototype.onBackground = function (background) {\n var fg = this.toRgb();\n var bg = new TinyColor(background).toRgb();\n return new TinyColor({\n r: bg.r + (fg.r - bg.r) * fg.a,\n g: bg.g + (fg.g - bg.g) * fg.a,\n b: bg.b + (fg.b - bg.b) * fg.a\n });\n };\n /**\n * Alias for `polyad(3)`\n */\n\n\n TinyColor.prototype.triad = function () {\n return this.polyad(3);\n };\n /**\n * Alias for `polyad(4)`\n */\n\n\n TinyColor.prototype.tetrad = function () {\n return this.polyad(4);\n };\n /**\n * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)\n * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...\n */\n\n\n TinyColor.prototype.polyad = function (n) {\n var hsl = this.toHsl();\n var h = hsl.h;\n var result = [this];\n var increment = 360 / n;\n\n for (var i = 1; i < n; i++) {\n result.push(new TinyColor({\n h: (h + i * increment) % 360,\n s: hsl.s,\n l: hsl.l\n }));\n }\n\n return result;\n };\n /**\n * compare color vs current color\n */\n\n\n TinyColor.prototype.equals = function (color) {\n return this.toRgbString() === new TinyColor(color).toRgbString();\n };\n\n return TinyColor;\n}();\n\nexport { TinyColor }; // kept for backwards compatability with v1\n\nexport function tinycolor(color, opts) {\n if (color === void 0) {\n color = '';\n }\n\n if (opts === void 0) {\n opts = {};\n }\n\n return new TinyColor(color, opts);\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/@ctrl/tinycolor/dist/module/index.js"],"names":["rgbaToHex","rgbToHex","rgbToHsl","rgbToHsv","numberInputToObject","names","inputToRGB","bound01","boundAlpha","clamp01","TinyColor","color","opts","_a","originalInput","rgb","r","g","b","a","roundA","Math","round","format","gradientType","isValid","ok","prototype","isDark","getBrightness","isLight","toRgb","getLuminance","R","G","B","RsRGB","GsRGB","BsRGB","pow","getAlpha","setAlpha","alpha","toHsv","hsv","h","s","v","toHsvString","toHsl","hsl","l","toHslString","toHex","allow3Char","toHexString","toHex8","allow4Char","toHex8String","toRgbString","toPercentageRgb","fmt","x","toPercentageRgbString","rnd","toName","hex","_i","Object","entries","length","_b","key","value","toString","formatSet","Boolean","formattedString","hasAlpha","needsAlphaFormat","startsWith","toNumber","clone","lighten","amount","brighten","max","min","darken","tint","mix","shade","desaturate","saturate","greyscale","spin","hue","rgb1","rgb2","p","rgba","analogous","results","slices","part","ret","push","complement","monochromatic","res","modification","splitcomplement","onBackground","background","fg","bg","triad","polyad","tetrad","n","result","increment","i","equals","tinycolor"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,QAApB,EAA8BC,QAA9B,EAAwCC,QAAxC,EAAkDC,mBAAlD,QAA6E,cAA7E;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,UAAT,QAA2B,gBAA3B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,OAA9B,QAA6C,QAA7C;;AACA,IAAIC,SAAS;AAAG;AAAe,YAAY;AACvC,WAASA,SAAT,CAAmBC,KAAnB,EAA0BC,IAA1B,EAAgC;AAC5B,QAAID,KAAK,KAAK,KAAK,CAAnB,EAAsB;AAAEA,MAAAA,KAAK,GAAG,EAAR;AAAa;;AACrC,QAAIC,IAAI,KAAK,KAAK,CAAlB,EAAqB;AAAEA,MAAAA,IAAI,GAAG,EAAP;AAAY;;AACnC,QAAIC,EAAJ,CAH4B,CAI5B;;;AACA,QAAIF,KAAK,YAAYD,SAArB,EAAgC;AAC5B;AACA,aAAOC,KAAP;AACH;;AACD,QAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC3BA,MAAAA,KAAK,GAAGP,mBAAmB,CAACO,KAAD,CAA3B;AACH;;AACD,SAAKG,aAAL,GAAqBH,KAArB;AACA,QAAII,GAAG,GAAGT,UAAU,CAACK,KAAD,CAApB;AACA,SAAKG,aAAL,GAAqBH,KAArB;AACA,SAAKK,CAAL,GAASD,GAAG,CAACC,CAAb;AACA,SAAKC,CAAL,GAASF,GAAG,CAACE,CAAb;AACA,SAAKC,CAAL,GAASH,GAAG,CAACG,CAAb;AACA,SAAKC,CAAL,GAASJ,GAAG,CAACI,CAAb;AACA,SAAKC,MAAL,GAAcC,IAAI,CAACC,KAAL,CAAW,MAAM,KAAKH,CAAtB,IAA2B,GAAzC;AACA,SAAKI,MAAL,GAAc,CAACV,E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,EAAAA,SAAS,CAACiB,SAAV,CAAoBgG,MAApB,GAA6B,UAAUhH,KAAV,EAAiB;AAC1C,WAAO,KAAKgD,WAAL,OAAuB,IAAIjD,SAAJ,CAAcC,KAAd,EAAqBgD,WAArB,EAA9B;AACH,GAFD;;AAGA,SAAOjD,SAAP;AACH,CApe8B,EAA/B;;AAqeA,SAASA,SAAT,G,CACA;;AACA,OAAO,SAASkH,SAAT,CAAmBjH,KAAnB,EAA0BC,IAA1B,EAAgC;AACnC,MAAID,KAAK,KAAK,KAAK,CAAnB,EAAsB;AAAEA,IAAAA,KAAK,GAAG,EAAR;AAAa;;AACrC,MAAIC,IAAI,KAAK,KAAK,CAAlB,EAAqB;AAAEA,IAAAA,IAAI,GAAG,EAAP;AAAY;;AACnC,SAAO,IAAIF,SAAJ,CAAcC,KAAd,EAAqBC,IAArB,CAAP;AACH","sourcesContent":["import { rgbaToHex, rgbToHex, rgbToHsl, rgbToHsv, numberInputToObject } from './conversion';\nimport { names } from './css-color-names';\nimport { inputToRGB } from './format-input';\nimport { bound01, boundAlpha, clamp01 } from './util';\nvar TinyColor = /** @class */ (function () {\n function TinyColor(color, opts) {\n if (color === void 0) { color = ''; }\n if (opts === void 0) { opts = {}; }\n var _a;\n // If input is already a tinycolor, return itself\n if (color instanceof TinyColor) {\n // eslint-disable-next-line no-constructor-return\n return color;\n }\n if (typeof color === 'number') {\n color = numberInputToObject(color);\n }\n this.originalInput = color;\n var rgb = inputToRGB(color);\n this.originalInput = color;\n this.r = rgb.r;\n this.g = rgb.g;\n this.b = rgb.b;\n this.a = rgb.a;\n this.roundA = Math.round(100 * this.a) / 100;\n this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;\n this.gradientType = opts.gradientType;\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this.r < 1) {\n this.r = Math.round(this.r);\n }\n if (this.g < 1) {\n this.g = Math.round(this.g);\n }\n if (this.b < 1) {\n this.b = Math.round(this.b);\n }\n this.isValid = rgb.ok;\n }\n TinyColor.prototype.isDark = function () {\n return this.getBrightness() < 128;\n };\n TinyColor.prototype.isLight = function () {\n return !this.isDark();\n };\n /**\n * Returns the perceived brightness of the color, from 0-255.\n */\n TinyColor.prototype.getBrightness = function () {\n // http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n };\n /**\n * Returns the perceived luminance of a color, from 0-1.\n */\n TinyColor.prototype.getLuminance = function () {\n // http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var R;\n var G;\n var B;\n var RsRGB = rgb.r / 255;\n var GsRGB = rgb.g / 255;\n var BsRGB = rgb.b / 255;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n }\n else {\n // eslint-disable-next-line prefer-exponentiation-operator\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n }\n else {\n // eslint-disable-next-line prefer-exponentiation-operator\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n }\n else {\n // eslint-disable-next-line prefer-exponentiation-operator\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n return 0.2126 * R + 0.7152 * G + 0.0722 * B;\n };\n /**\n * Returns the alpha value of a color, from 0-1.\n */\n TinyColor.prototype.getAlpha = function () {\n return this.a;\n };\n /**\n * Sets the alpha value on the current color.\n *\n * @param alpha - The new alpha value. The accepted range is 0-1.\n */\n TinyColor.prototype.setAlpha = function (alpha) {\n this.a = boundAlpha(alpha);\n this.roundA = Math.round(100 * this.a) / 100;\n return this;\n };\n /**\n * Returns the object as a HSVA object.\n */\n TinyColor.prototype.toHsv = function () {\n var hsv = rgbToHsv(this.r, this.g, this.b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };\n };\n /**\n * Returns the hsva values interpolated into a string with the following format:\n * \"hsva(xxx, xxx, xxx, xx)\".\n */\n TinyColor.prototype.toHsvString = function () {\n var hsv = rgbToHsv(this.r, this.g, this.b);\n var h = Math.round(hsv.h * 360);\n var s = Math.round(hsv.s * 100);\n var v = Math.round(hsv.v * 100);\n return this.a === 1 ? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" : \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + this.roundA + \")\";\n };\n /**\n * Returns the object as a HSLA object.\n */\n TinyColor.prototype.toHsl = function () {\n var hsl = rgbToHsl(this.r, this.g, this.b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };\n };\n /**\n * Returns the hsla values interpolated into a string with the following format:\n * \"hsla(xxx, xxx, xxx, xx)\".\n */\n TinyColor.prototype.toHslString = function () {\n var hsl = rgbToHsl(this.r, this.g, this.b);\n var h = Math.round(hsl.h * 360);\n var s = Math.round(hsl.s * 100);\n var l = Math.round(hsl.l * 100);\n return this.a === 1 ? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" : \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + this.roundA + \")\";\n };\n /**\n * Returns the hex value of the color.\n * @param allow3Char will shorten hex value to 3 char if possible\n */\n TinyColor.prototype.toHex = function (allow3Char) {\n if (allow3Char === void 0) { allow3Char = false; }\n return rgbToHex(this.r, this.g, this.b, allow3Char);\n };\n /**\n * Returns the hex value of the color -with a # appened.\n * @param allow3Char will shorten hex value to 3 char if possible\n */\n TinyColor.prototype.toHexString = function (allow3Char) {\n if (allow3Char === void 0) { allow3Char = false; }\n return '#' + this.toHex(allow3Char);\n };\n /**\n * Returns the hex 8 value of the color.\n * @param allow4Char will shorten hex value to 4 char if possible\n */\n TinyColor.prototype.toHex8 = function (allow4Char) {\n if (allow4Char === void 0) { allow4Char = false; }\n return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);\n };\n /**\n * Returns the hex 8 value of the color -with a # appened.\n * @param allow4Char will shorten hex value to 4 char if possible\n */\n TinyColor.prototype.toHex8String = function (allow4Char) {\n if (allow4Char === void 0) { allow4Char = false; }\n return '#' + this.toHex8(allow4Char);\n };\n /**\n * Returns the object as a RGBA object.\n */\n TinyColor.prototype.toRgb = function () {\n return {\n r: Math.round(this.r),\n g: Math.round(this.g),\n b: Math.round(this.b),\n a: this.a,\n };\n };\n /**\n * Returns the RGBA values interpolated into a string with the following format:\n * \"RGBA(xxx, xxx, xxx, xx)\".\n */\n TinyColor.prototype.toRgbString = function () {\n var r = Math.round(this.r);\n var g = Math.round(this.g);\n var b = Math.round(this.b);\n return this.a === 1 ? \"rgb(\" + r + \", \" + g + \", \" + b + \")\" : \"rgba(\" + r + \", \" + g + \", \" + b + \", \" + this.roundA + \")\";\n };\n /**\n * Returns the object as a RGBA object.\n */\n TinyColor.prototype.toPercentageRgb = function () {\n var fmt = function (x) { return Math.round(bound01(x, 255) * 100) + \"%\"; };\n return {\n r: fmt(this.r),\n g: fmt(this.g),\n b: fmt(this.b),\n a: this.a,\n };\n };\n /**\n * Returns the RGBA relative values interpolated into a string\n */\n TinyColor.prototype.toPercentageRgbString = function () {\n var rnd = function (x) { return Math.round(bound01(x, 255) * 100); };\n return this.a === 1\n ? \"rgb(\" + rnd(this.r) + \"%, \" + rnd(this.g) + \"%, \" + rnd(this.b) + \"%)\"\n : \"rgba(\" + rnd(this.r) + \"%, \" + rnd(this.g) + \"%, \" + rnd(this.b) + \"%, \" + this.roundA + \")\";\n };\n /**\n * The 'real' name of the color -if there is one.\n */\n TinyColor.prototype.toName = function () {\n if (this.a === 0) {\n return 'transparent';\n }\n if (this.a < 1) {\n return false;\n }\n var hex = '#' + rgbToHex(this.r, this.g, this.b, false);\n for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {\n var _b = _a[_i], key = _b[0], value = _b[1];\n if (hex === value) {\n return key;\n }\n }\n return false;\n };\n /**\n * String representation of the color.\n *\n * @param format - The format to be used when displaying the string representation.\n */\n TinyColor.prototype.toString = function (format) {\n var formatSet = Boolean(format);\n format = format !== null && format !== void 0 ? format : this.format;\n var formattedString = false;\n var hasAlpha = this.a < 1 && this.a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith('hex') || format === 'name');\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === 'name' && this.a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === 'rgb') {\n formattedString = this.toRgbString();\n }\n if (format === 'prgb') {\n formattedString = this.toPercentageRgbString();\n }\n if (format === 'hex' || format === 'hex6') {\n formattedString = this.toHexString();\n }\n if (format === 'hex3') {\n formattedString = this.toHexString(true);\n }\n if (format === 'hex4') {\n formattedString = this.toHex8String(true);\n }\n if (format === 'hex8') {\n formattedString = this.toHex8String();\n }\n if (format === 'name') {\n formattedString = this.toName();\n }\n if (format === 'hsl') {\n formattedString = this.toHslString();\n }\n if (format === 'hsv') {\n formattedString = this.toHsvString();\n }\n return formattedString || this.toHexString();\n };\n TinyColor.prototype.toNumber = function () {\n return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);\n };\n TinyColor.prototype.clone = function () {\n return new TinyColor(this.toString());\n };\n /**\n * Lighten the color a given amount. Providing 100 will always return white.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.lighten = function (amount) {\n if (amount === void 0) { amount = 10; }\n var hsl = this.toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return new TinyColor(hsl);\n };\n /**\n * Brighten the color a given amount, from 0 to 100.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.brighten = function (amount) {\n if (amount === void 0) { amount = 10; }\n var rgb = this.toRgb();\n rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));\n rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));\n rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));\n return new TinyColor(rgb);\n };\n /**\n * Darken the color a given amount, from 0 to 100.\n * Providing 100 will always return black.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.darken = function (amount) {\n if (amount === void 0) { amount = 10; }\n var hsl = this.toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return new TinyColor(hsl);\n };\n /**\n * Mix the color with pure white, from 0 to 100.\n * Providing 0 will do nothing, providing 100 will always return white.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.tint = function (amount) {\n if (amount === void 0) { amount = 10; }\n return this.mix('white', amount);\n };\n /**\n * Mix the color with pure black, from 0 to 100.\n * Providing 0 will do nothing, providing 100 will always return black.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.shade = function (amount) {\n if (amount === void 0) { amount = 10; }\n return this.mix('black', amount);\n };\n /**\n * Desaturate the color a given amount, from 0 to 100.\n * Providing 100 will is the same as calling greyscale\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.desaturate = function (amount) {\n if (amount === void 0) { amount = 10; }\n var hsl = this.toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return new TinyColor(hsl);\n };\n /**\n * Saturate the color a given amount, from 0 to 100.\n * @param amount - valid between 1-100\n */\n TinyColor.prototype.saturate = function (amount) {\n if (amount === void 0) { amount = 10; }\n var hsl = this.toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return new TinyColor(hsl);\n };\n /**\n * Completely desaturates a color into greyscale.\n * Same as calling `desaturate(100)`\n */\n TinyColor.prototype.greyscale = function () {\n return this.desaturate(100);\n };\n /**\n * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n * Values outside of this range will be wrapped into this range.\n */\n TinyColor.prototype.spin = function (amount) {\n var hsl = this.toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return new TinyColor(hsl);\n };\n /**\n * Mix the current color a given amount with another color, from 0 to 100.\n * 0 means no mixing (return current color).\n */\n TinyColor.prototype.mix = function (color, amount) {\n if (amount === void 0) { amount = 50; }\n var rgb1 = this.toRgb();\n var rgb2 = new TinyColor(color).toRgb();\n var p = amount / 100;\n var rgba = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b,\n a: (rgb2.a - rgb1.a) * p + rgb1.a,\n };\n return new TinyColor(rgba);\n };\n TinyColor.prototype.analogous = function (results, slices) {\n if (results === void 0) { results = 6; }\n if (slices === void 0) { slices = 30; }\n var hsl = this.toHsl();\n var part = 360 / slices;\n var ret = [this];\n for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results;) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(new TinyColor(hsl));\n }\n return ret;\n };\n /**\n * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js\n */\n TinyColor.prototype.complement = function () {\n var hsl = this.toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return new TinyColor(hsl);\n };\n TinyColor.prototype.monochromatic = function (results) {\n if (results === void 0) { results = 6; }\n var hsv = this.toHsv();\n var h = hsv.h;\n var s = hsv.s;\n var v = hsv.v;\n var res = [];\n var modification = 1 / results;\n while (results--) {\n res.push(new TinyColor({ h: h, s: s, v: v }));\n v = (v + modification) % 1;\n }\n return res;\n };\n TinyColor.prototype.splitcomplement = function () {\n var hsl = this.toHsl();\n var h = hsl.h;\n return [\n this,\n new TinyColor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),\n new TinyColor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),\n ];\n };\n /**\n * Compute how the color would appear on a background\n */\n TinyColor.prototype.onBackground = function (background) {\n var fg = this.toRgb();\n var bg = new TinyColor(background).toRgb();\n return new TinyColor({\n r: bg.r + (fg.r - bg.r) * fg.a,\n g: bg.g + (fg.g - bg.g) * fg.a,\n b: bg.b + (fg.b - bg.b) * fg.a,\n });\n };\n /**\n * Alias for `polyad(3)`\n */\n TinyColor.prototype.triad = function () {\n return this.polyad(3);\n };\n /**\n * Alias for `polyad(4)`\n */\n TinyColor.prototype.tetrad = function () {\n return this.polyad(4);\n };\n /**\n * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)\n * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...\n */\n TinyColor.prototype.polyad = function (n) {\n var hsl = this.toHsl();\n var h = hsl.h;\n var result = [this];\n var increment = 360 / n;\n for (var i = 1; i < n; i++) {\n result.push(new TinyColor({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));\n }\n return result;\n };\n /**\n * compare color vs current color\n */\n TinyColor.prototype.equals = function (color) {\n return this.toRgbString() === new TinyColor(color).toRgbString();\n };\n return TinyColor;\n}());\nexport { TinyColor };\n// kept for backwards compatability with v1\nexport function tinycolor(color, opts) {\n if (color === void 0) { color = ''; }\n if (opts === void 0) { opts = {}; }\n return new TinyColor(color, opts);\n}\n"]},"metadata":{},"sourceType":"module"}