{"version":3,"file":"index.exports.import.es.mjs","sources":["../src/guard.ts","../src/ColorError.ts","../src/parseToRgba.ts","../src/parseToHsla.ts","../src/hsla.ts","../src/adjustHue.ts","../src/complement.ts","../src/darken.ts","../src/desaturate.ts","../src/getLuminance.ts","../src/getContrast.ts","../src/rgba.ts","../src/mix.ts","../src/getScale.ts","../src/hasBadContrast.ts","../src/invert.ts","../src/lighten.ts","../src/transparentize.ts","../src/opacify.ts","../src/readableColorIsBlack.ts","../src/readableColor.ts","../src/saturate.ts","../src/toHex.ts","../src/toRgba.ts","../src/toHsla.ts"],"sourcesContent":["/**\n * Clamps a number between a lower and upper bound.\n *\n * ```js\n * guard(0, 1, 2); // 1\n * ```\n *\n * @param low The lower bound.\n * @param high The upper bound.\n * @param value The number to clamp.\n * @returns The clamped number.\n */\nfunction guard(low: number, high: number, value: number): number {\n  return Math.min(Math.max(low, value), high);\n}\n\nexport default guard;\n","/**\n * Error thrown when color2k cannot parse an input color.\n *\n * ```js\n * new ColorError('nope').message; // 'Failed to parse color: \"nope\"'\n * ```\n *\n * @param color The color value that failed to parse.\n */\nclass ColorError extends Error {\n  constructor(color: string) {\n    super(`Failed to parse color: \"${color}\"`);\n  }\n}\n\nexport default ColorError;\n","import guard from './guard';\nimport ColorError from './ColorError';\n\n/**\n * Parses a color into red, green, blue, and alpha channel values.\n *\n * Reads hex (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`), comma-separated\n * `rgb()`, `rgba()`, `hsl()` and `hsla()`, CSS named colors, and\n * `transparent`.\n *\n * This is a lenient parser, not a validator. Most strings in none of these\n * forms throw a `ColorError`, but not all: color names are matched by hash,\n * so about 3% of made-up, letters-only names are read as some color instead.\n * The numbers in `rgb()` and the alpha value are returned as written, without\n * clamping: `rgb(999, 0, 0)` gives `[999, 0, 0, 1]`.\n *\n * ```js\n * parseToRgba('rgba(255, 0, 0, 0.5)'); // [255, 0, 0, 0.5]\n * ```\n *\n * @param color The input color.\n * @returns A tuple in the order `[red, green, blue, alpha]`.\n */\nfunction parseToRgba(color: string): [number, number, number, number] {\n  if (typeof color !== 'string') throw new ColorError(color);\n  // Ignore surrounding whitespace; errors still report the original `color`.\n  const input = color.trim();\n  if (input.toLowerCase() === 'transparent') return [0, 0, 0, 0];\n\n  if (namedColorRegex.test(input)) {\n    // named colors: hash the name, then walk `colorMap` (see below)\n    let hash = 852;\n    let i = input.length;\n    while (i) hash = (hash * 56 + (input.charCodeAt(--i) % 32)) % 4701;\n    for (; (hash -= colorMap.charCodeAt(i) % 95) > 0; i += 5);\n    if (hash === 0) {\n      return [\n        ...[1, 2, 3].map(\n          (j) =>\n            (168 -\n              (colorMap.charCodeAt(i + j) % 95) +\n              ((colorMap.charCodeAt(i + 4) % 95) >> (6 - 2 * j)) * 64) &\n            255\n        ),\n        1,\n      ] as [number, number, number, number];\n    }\n  }\n\n  const reducedHexMatch = reducedHexRegex.exec(input);\n  if (reducedHexMatch) {\n    const arr = Array.from(reducedHexMatch).slice(1);\n    return [\n      ...arr.slice(0, 3).map((x) => parseInt(r(x, 2), 16)),\n      parseInt(r(arr[3] || 'f', 2), 16) / 255,\n    ] as [number, number, number, number];\n  }\n\n  const hexMatch = hexRegex.exec(input);\n  if (hexMatch) {\n    const arr = Array.from(hexMatch).slice(1);\n    return [\n      ...arr.slice(0, 3).map((x) => parseInt(x, 16)),\n      parseInt(arr[3] || 'ff', 16) / 255,\n    ] as [number, number, number, number];\n  }\n\n  const rgbaMatch = rgbaRegex.exec(input);\n  if (rgbaMatch) {\n    const arr = Array.from(rgbaMatch).slice(1);\n    return [\n      ...arr.slice(0, 3).map((x) => parseInt(x, 10)),\n      parseFloat(arr[3] || '1'),\n    ] as [number, number, number, number];\n  }\n\n  const hslaMatch = hslaRegex.exec(input);\n  if (hslaMatch) {\n    const [h, s, l, a] = Array.from(hslaMatch).slice(1).map(parseFloat);\n    if (guard(0, 100, s) !== s) throw new ColorError(color);\n    if (guard(0, 100, l) !== l) throw new ColorError(color);\n    return [...hslToRgb(h, s, l), Number.isNaN(a) ? 1 : a] as [\n      number,\n      number,\n      number,\n      number\n    ];\n  }\n\n  throw new ColorError(color);\n}\n\n/**\n * The CSS named colors, generated by `scripts/color-map.ts`.\n *\n * Each color is 5 characters and each character holds `charCode % 95`:\n *\n * 1. the gap between this color's name hash and the previous one (colors are\n *    sorted by hash so the lookup above subtracts gaps from the hash until it\n *    reaches zero or less)\n * 2. to 4. the low 6 bits of `168 - channel` for red, green, and blue\n * 5. the 2 bits per channel that step 2 loses\n *\n * A name that is not a color is rejected unless its hash happens to match one\n * of the 148 stored hashes (roughly a 3% chance).\n */\nconst colorMap =\n  '!hig0$o)ot<00)*m)((*xmz6f,b>>n1|#tmi=yda#333*z|((in!y=ej)c3%3!r#w-???t )(|%>)..*o8gatt?q. N|(|gg+1=sa,,(ieks,zpmbgqo))w#A33k)6;oat}}=el2;)9zas(th3(((_O|(&8v))(ig8(w_!!y.e6???_U){(\"i)0k)V(((t!()(*d())*iz#)r`zkk~h)()*a8a{$~ v{5wkkktocr;2k))shg))8*i).z)l.=p)/a5n<b())(c9::yu)p(&{((((t8))*r6z67Ug))yy.rt|z)cf%5)d!/o,574h:_>%}u?iqc())&b3i5%%)83*m)()*]???_H)=z)w)?4!@g6>%x(yv%s)g. o>mzlq(((*b6eey,))g)3(((ise|e\"biw)\"vi0!srjgjpf)st(9(((_x0\"|qMl8tof)c$%e)i;%S)b(\"*)m/%o8$itao-og-((|($(((a(8)8*08(( s(gw5ottttaaa.u|t8l`rw:wginn8({u4{sk3).*}(()*4(((gN())*G)#(.|(|| +..u)c9xx?jm8qpk:|p3%(c(.!((( s80)*t\\'?f1]???t$az>5l+3a)>.(6 `-_:mi)9r)G:&:\"C)3:*W.8a)jn6{lj)))*%x,xcj)2\\'%v9xx?=1 n_/((z)f +|<)\"&41.4cg#$))(*e(.m(wtttt11 n_3).8*d8(w_n(((\"/gu;n*r=93e,xxo';\n\nconst r = (str: string, amount: number) =>\n  Array.from(Array(amount))\n    .map(() => str)\n    .join('');\n\nconst reducedHexRegex = new RegExp(`^#${r('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');\nconst hexRegex = new RegExp(`^#${r('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');\nconst rgbaRegex = new RegExp(\n  `^rgba?\\\\(\\\\s*(\\\\d+)\\\\s*${r(\n    ',\\\\s*(\\\\d+)\\\\s*',\n    2\n  )}(?:,\\\\s*(\\\\d+\\\\.?\\\\d*|\\\\.\\\\d+))?\\\\s*\\\\)$`,\n  'i'\n);\nconst hslaRegex =\n  /^hsla?\\(\\s*(\\d+\\.?\\d*|\\.\\d+)\\s*,\\s*(\\d+\\.?\\d*|\\.\\d+)%\\s*,\\s*(\\d+\\.?\\d*|\\.\\d+)%(?:\\s*,\\s*(\\d+\\.?\\d*|\\.\\d+))?\\s*\\)$/i;\nconst namedColorRegex = /^[a-z]+$/i;\n\nconst roundColor = (color: number): number => {\n  return Math.round(color * 255);\n};\n\nconst hslToRgb = (\n  hue: number,\n  saturation: number,\n  lightness: number\n): [number, number, number] => {\n  let l = lightness / 100;\n  if (saturation === 0) {\n    // achromatic\n    return [l, l, l].map(roundColor) as [number, number, number];\n  }\n\n  // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV\n  const huePrime = (((hue % 360) + 360) % 360) / 60;\n  const chroma = (1 - Math.abs(2 * l - 1)) * (saturation / 100);\n  const secondComponent = chroma * (1 - Math.abs((huePrime % 2) - 1));\n\n  let red = 0;\n  let green = 0;\n  let blue = 0;\n\n  if (huePrime >= 0 && huePrime < 1) {\n    red = chroma;\n    green = secondComponent;\n  } else if (huePrime >= 1 && huePrime < 2) {\n    red = secondComponent;\n    green = chroma;\n  } else if (huePrime >= 2 && huePrime < 3) {\n    green = chroma;\n    blue = secondComponent;\n  } else if (huePrime >= 3 && huePrime < 4) {\n    green = secondComponent;\n    blue = chroma;\n  } else if (huePrime >= 4 && huePrime < 5) {\n    red = secondComponent;\n    blue = chroma;\n  } else if (huePrime >= 5 && huePrime < 6) {\n    red = chroma;\n    blue = secondComponent;\n  }\n\n  const lightnessModification = l - chroma / 2;\n  const finalRed = red + lightnessModification;\n  const finalGreen = green + lightnessModification;\n  const finalBlue = blue + lightnessModification;\n\n  return [finalRed, finalGreen, finalBlue].map(roundColor) as [\n    number,\n    number,\n    number\n  ];\n};\n\nexport default parseToRgba;\n","// taken from:\n// https://github.com/styled-components/polished/blob/a23a6a2bb26802b3d922d9c3b67bac3f3a54a310/src/internalHelpers/_rgbToHsl.js\nimport parseToRgba from './parseToRgba';\n\n/**\n * Parses a color into hue, saturation, lightness, and alpha channel values.\n *\n * Hue is a number between 0 and 360. Saturation, lightness, and alpha are\n * decimal percentages between 0 and 1.\n *\n * ```js\n * parseToHsla('red'); // [0, 1, 0.5, 1]\n * ```\n *\n * @param color The input color.\n * @returns A tuple in the order `[hue, saturation, lightness, alpha]`.\n */\nfunction parseToHsla(color: string): [number, number, number, number] {\n  const [red, green, blue, alpha] = parseToRgba(color).map((value, index) =>\n    // 3rd index is alpha channel which is already normalized\n    index === 3 ? value : value / 255\n  );\n\n  const max = Math.max(red, green, blue);\n  const min = Math.min(red, green, blue);\n  const lightness = (max + min) / 2;\n\n  // achromatic\n  if (max === min) return [0, 0, lightness, alpha];\n\n  const delta = max - min;\n  const saturation =\n    lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);\n\n  const hue =\n    60 *\n    (red === max\n      ? (green - blue) / delta + (green < blue ? 6 : 0)\n      : green === max\n      ? (blue - red) / delta + 2\n      : (red - green) / delta + 4);\n\n  return [hue, saturation, lightness, alpha];\n}\n\nexport default parseToHsla;\n","import guard from './guard';\n\n/**\n * Builds an `hsla` color string from hue, saturation, lightness, and alpha\n * channel values.\n *\n * ```js\n * hsla(0, 1, 0.5, 1); // 'hsla(0, 100%, 50%, 1)'\n * ```\n *\n * @param hue The color wheel angle in degrees. Any value wraps into 0 to 360.\n * @param saturation The saturation as a decimal between 0 and 1.\n * @param lightness The lightness as a decimal between 0 and 1.\n * @param alpha The opacity as a decimal between 0 and 1.\n * @returns An `hsla` color string.\n */\nfunction hsla(\n  hue: number,\n  saturation: number,\n  lightness: number,\n  alpha: number\n): string {\n  // Positive hues are rounded exactly as `hue % 360`. Negative ones are rounded\n  // before 360 is added, so float error from the addition can't move them.\n  const wrapped = hue % 360;\n  return `hsla(${(wrapped < 0 ? Math.round(wrapped) + 360 : wrapped).toFixed()}, ${guard(\n    0,\n    100,\n    saturation * 100\n  ).toFixed()}%, ${guard(0, 100, lightness * 100).toFixed()}%, ${parseFloat(\n    guard(0, 1, alpha).toFixed(3)\n  )})`;\n}\n\nexport default hsla;\n","import parseToHsla from './parseToHsla';\nimport hsla from './hsla';\n\n/**\n * Rotates a color's hue by the given number of degrees and returns the result\n * as an `hsla` string.\n *\n * A hue past 360 wraps around the color wheel. A hue below 0 does not: when\n * the color's own hue plus `degrees` is negative, the result has a negative\n * hue. `adjustHue('red', -120)` returns `hsla(-120, 100%, 50%, 1)`, which\n * browsers understand but color2k cannot parse again. `adjustHue('blue', -120)`\n * is fine, because blue's hue is 240.\n *\n * ```js\n * adjustHue('red', 180); // 'hsla(180, 100%, 50%, 1)'\n * ```\n *\n * @param color The input color.\n * @param degrees The number of degrees to rotate the hue.\n * @returns The adjusted color as an `hsla` string.\n */\nfunction adjustHue(color: string, degrees: number): string {\n  const [h, s, l, a] = parseToHsla(color);\n  return hsla(h + degrees, s, l, a);\n}\n\nexport default adjustHue;\n","import adjustHue from './adjustHue';\n\n/**\n * Rotates a color's hue by 180 degrees and returns the result as an `hsla`\n * string, like Sass's `complement`.\n *\n * Like `adjustHue`, the result is rounded to whole degrees and percents, so\n * each channel can be up to 5 away from Sass's exact result. Grays have no hue\n * and keep their color, but their channels can move by 1 from that rounding.\n *\n * ```js\n * complement('red'); // 'hsla(180, 100%, 50%, 1)'\n * ```\n *\n * @param color The input color.\n * @returns The complementary color as an `hsla` string.\n */\nfunction complement(color: string): string {\n  return adjustHue(color, 180);\n}\n\nexport default complement;\n","import parseToHsla from './parseToHsla';\nimport hsla from './hsla';\n\n/**\n * Darkens a color by subtracting from the lightness channel in HSL space.\n *\n * ```js\n * darken('white', 0.1); // 'hsla(0, 0%, 90%, 1)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to darken, given as a decimal between 0 and 1.\n * @returns The darkened color as an `hsla` string.\n */\nfunction darken(color: string, amount: number): string {\n  const [hue, saturation, lightness, alpha] = parseToHsla(color);\n  return hsla(hue, saturation, lightness - amount, alpha);\n}\n\nexport default darken;\n","import parseToHsla from './parseToHsla';\nimport hsla from './hsla';\n\n/**\n * Desaturates a color by subtracting from the saturation channel in HSL space.\n *\n * ```js\n * desaturate('red', 0.5); // 'hsla(0, 50%, 50%, 1)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to desaturate, given as a decimal between 0 and 1.\n * @returns The desaturated color as an `hsla` string.\n */\nfunction desaturate(color: string, amount: number): string {\n  const [h, s, l, a] = parseToHsla(color);\n  return hsla(h, s - amount, l, a);\n}\n\nexport default desaturate;\n","import parseToRgba from './parseToRgba';\n// taken from:\n// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getLuminance.js\n\n/**\n * Returns the relative luminance of a color using the WCAG formula.\n *\n * ```js\n * getLuminance('papayawhip'); // 0.877971001998354\n * ```\n *\n * @param color The input color.\n * @returns A number between 0 for darkest black and 1 for lightest white.\n */\nfunction getLuminance(color: string): number {\n  if (color === 'transparent') return 0;\n\n  function f(x: number) {\n    const channel = x / 255;\n    return channel <= 0.04045\n      ? channel / 12.92\n      : Math.pow(((channel + 0.055) / 1.055), 2.4);\n  }\n\n  const [r, g, b] = parseToRgba(color);\n  return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);\n}\n\nexport default getLuminance;\n","// taken from:\n// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getContrast.js\nimport getLuminance from './getLuminance';\n\n/**\n * Returns the contrast ratio between two colors based on the WCAG contrast\n * ratio formula.\n *\n * The ratio is between 1 and 21 for opaque, in-range colors. Alpha is ignored,\n * and out-of-range channels such as `rgb(999, 0, 0)` are not clamped, so they\n * give ratios that mean nothing.\n *\n * ```js\n * getContrast('#444', '#fff'); // 9.739769120526205\n * ```\n *\n * @param color1 The first color.\n * @param color2 The second color.\n * @returns The contrast ratio between the two colors.\n */\nfunction getContrast(color1: string, color2: string): number {\n  const luminance1 = getLuminance(color1);\n  const luminance2 = getLuminance(color2);\n\n  return luminance1 > luminance2\n    ? (luminance1 + 0.05) / (luminance2 + 0.05)\n    : (luminance2 + 0.05) / (luminance1 + 0.05);\n}\n\nexport default getContrast;\n","import guard from './guard';\n\n/**\n * Builds an `rgba` color string from red, green, blue, and alpha channel\n * values.\n *\n * ```js\n * rgba(255, 0, 0, 1); // 'rgba(255, 0, 0, 1)'\n * ```\n *\n * @param red The red channel value from 0 to 255.\n * @param green The green channel value from 0 to 255.\n * @param blue The blue channel value from 0 to 255.\n * @param alpha The opacity as a decimal between 0 and 1.\n * @returns An `rgba` color string.\n */\nfunction rgba(red: number, green: number, blue: number, alpha: number): string {\n  return `rgba(${guard(0, 255, red).toFixed()}, ${guard(\n    0,\n    255,\n    green\n  ).toFixed()}, ${guard(0, 255, blue).toFixed()}, ${parseFloat(\n    guard(0, 1, alpha).toFixed(3)\n  )})`;\n}\n\nexport default rgba;\n","import parseToRgba from './parseToRgba';\nimport rgba from './rgba';\n\n/**\n * Mixes two colors together using the Sass mix algorithm and returns an `rgba`\n * color string.\n *\n * ```js\n * mix('red', 'blue', 0.5); // 'rgba(128, 0, 128, 1)'\n * ```\n *\n * @param color1 The first color.\n * @param color2 The second color.\n * @param weight The mix weight as a decimal between 0 and 1.\n * @returns The mixed color as an `rgba` string.\n */\nfunction mix(color1: string, color2: string, weight: number): string {\n  const normalize = (n: number, index: number) =>\n    // 3rd index is alpha channel which is already normalized\n    index === 3 ? n : n / 255;\n\n  const [r1, g1, b1, a1] = parseToRgba(color1).map(normalize);\n  const [r2, g2, b2, a2] = parseToRgba(color2).map(normalize);\n\n  // The formula is copied from the original Sass implementation:\n  // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method\n  const alphaDelta = a2 - a1;\n  const normalizedWeight = weight * 2 - 1;\n  const combinedWeight =\n    normalizedWeight * alphaDelta === -1\n      ? normalizedWeight\n      : (normalizedWeight + alphaDelta) / (1 + normalizedWeight * alphaDelta);\n  const weight2 = (combinedWeight + 1) / 2;\n  const weight1 = 1 - weight2;\n\n  const r = (r1 * weight1 + r2 * weight2) * 255;\n  const g = (g1 * weight1 + g2 * weight2) * 255;\n  const b = (b1 * weight1 + b2 * weight2) * 255;\n  const a = a2 * weight + a1 * (1 - weight);\n\n  return rgba(r, g, b, a);\n}\n\nexport default mix;\n","import mix from './mix';\nimport guard from './guard';\n\n/**\n * Returns a scale function that interpolates through a list of colors.\n *\n * Pass at least two colors. With fewer there is nothing to interpolate\n * between, and the scale has no colors to return.\n *\n * The returned function accepts a decimal between 0 and 1 and returns the color\n * at that percentage in the scale.\n *\n * ```js\n * const scale = getScale('red', 'yellow', 'green');\n * console.log(scale(0)); // rgba(255, 0, 0, 1)\n * console.log(scale(0.5)); // rgba(255, 255, 0, 1)\n * console.log(scale(1)); // rgba(0, 128, 0, 1)\n * ```\n *\n * With a single color, the scale always returns that color.\n *\n * If you'd like to limit the domain and range like chroma-js, we recommend\n * wrapping scale again.\n *\n * ```js\n * const _scale = getScale('red', 'yellow', 'green');\n * const scale = x => _scale(x / 100);\n *\n * console.log(scale(0)); // rgba(255, 0, 0, 1)\n * console.log(scale(50)); // rgba(255, 255, 0, 1)\n * console.log(scale(100)); // rgba(0, 128, 0, 1)\n * ```\n *\n * @param colors The colors to interpolate through.\n * @returns A function that maps a decimal percentage to an `rgba` color.\n */\nfunction getScale(...colors: string[]): (n: number) => string {\n  return (n) => {\n    const lastIndex = colors.length - 1;\n    const lowIndex = guard(0, lastIndex, Math.floor(n * lastIndex));\n    const highIndex = guard(0, lastIndex, Math.ceil(n * lastIndex));\n\n    const color1 = colors[lowIndex];\n    const color2 = colors[highIndex];\n\n    const unit = 1 / lastIndex;\n    // a single color has no second color to move toward\n    const weight = lastIndex ? (n - unit * lowIndex) / unit : 0;\n\n    return mix(color1, color2, weight);\n  };\n}\n\nexport default getScale;\n","import getContrast from './getContrast';\n\nconst guidelines = {\n  decorative: 1.5,\n  readable: 3,\n  aa: 4.5,\n  aaa: 7,\n};\n\n/**\n * Returns whether a color fails a contrast threshold against a background.\n *\n * The standards and the minimum contrast ratio each one needs are `decorative`\n * (1.5), `readable` (3), `aa` (4.5), and `aaa` (7). By default the color is\n * checked against `aa` on a white (`#fff`) background.\n *\n * ```js\n * hasBadContrast('red', 'aa'); // true\n * ```\n *\n * @param color The foreground color.\n * @param standard The contrast standard to test against. Defaults to `aa`.\n * @param background The background color. Defaults to `#fff`.\n * @returns `true` when the contrast ratio is below the selected standard.\n */\nfunction hasBadContrast(\n  color: string,\n  standard: 'decorative' | 'readable' | 'aa' | 'aaa' = 'aa',\n  background: string = '#fff'\n): boolean {\n  return getContrast(color, background) < guidelines[standard];\n}\n\nexport default hasBadContrast;\n","import parseToRgba from './parseToRgba';\nimport rgba from './rgba';\nimport guard from './guard';\n\n/**\n * Inverts a color's red, green, and blue channels, keeping its alpha, and\n * returns the result as an `rgba` string. This matches Sass's `invert`.\n *\n * `weight` controls how far to go toward the inverse: `1` (the default) fully\n * inverts the color, `0` returns it unchanged, and `0.5` always gives gray.\n * Weights outside 0 to 1 are clamped to that range. A weight that is not a\n * finite number (`NaN` or `Infinity`) throws a `RangeError`.\n *\n * ```js\n * invert('red'); // 'rgba(0, 255, 255, 1)'\n * invert('#336699', 0.25); // 'rgba(89, 115, 140, 1)'\n * ```\n *\n * @param color The input color.\n * @param weight How much to invert, given as a decimal between 0 and 1.\n * @returns The inverted color as an `rgba` string.\n */\nfunction invert(color: string, weight: number = 1): string {\n  if (!isFinite(weight)) throw new RangeError('weight');\n  const [red, green, blue, alpha] = parseToRgba(color);\n  const amount = guard(0, 1, weight);\n  // Same as `mix(color, inverse, weight)`: both colors share the same alpha.\n  const channel = (value: number) => value + (255 - 2 * value) * amount;\n  return rgba(channel(red), channel(green), channel(blue), alpha);\n}\n\nexport default invert;\n","import darken from './darken';\n/**\n * Lightens a color by adding to the lightness channel in HSL space.\n *\n * This is equivalent to `darken(color, -amount)`.\n *\n * ```js\n * lighten('black', 0.1); // 'hsla(0, 0%, 10%, 1)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to lighten, given as a decimal between 0 and 1.\n * @returns The lightened color as an `hsla` string.\n */\nfunction lighten(color: string, amount: number): string {\n  return darken(color, -amount);\n}\n\nexport default lighten;\n","import parseToRgba from './parseToRgba';\nimport rgba from './rgba';\n\n/**\n * Makes a color more transparent by decreasing the alpha channel.\n *\n * ```js\n * transparentize('white', 0.1); // 'rgba(255, 255, 255, 0.9)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to increase transparency by, given as a decimal between 0 and 1.\n * @returns The more transparent color as an `rgba` string.\n */\nfunction transparentize(color: string, amount: number): string {\n  const [r, g, b, a] = parseToRgba(color);\n  return rgba(r, g, b, a - amount);\n}\n\nexport default transparentize;\n","import transparentize from './transparentize';\n\n/**\n * Makes a color more opaque by increasing the alpha channel.\n *\n * This is equivalent to `transparentize(color, -amount)`.\n *\n * ```js\n * opacify('rgba(255, 255, 255, 0.5)', 0.1); // 'rgba(255, 255, 255, 0.6)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to increase opacity by, given as a decimal between 0 and 1.\n * @returns The more opaque color as an `rgba` string.\n */\nfunction opacify(color: string, amount: number): string {\n  return transparentize(color, -amount);\n}\n\nexport default opacify;\n","import getLuminance from './getLuminance';\n\n/**\n * Returns whether black is the more readable color to place on top of the\n * input color.\n *\n * This is the boolean form of `readableColor`.\n *\n * ```js\n * readableColorIsBlack('white'); // true\n * ```\n *\n * @param color The background color.\n * @returns `true` when black is the more readable foreground color.\n */\nfunction readableColorIsBlack(color: string): boolean {\n  return getLuminance(color) > 0.179;\n}\n\nexport default readableColorIsBlack;\n","import readableColorIsBlack from './readableColorIsBlack';\n\n/**\n * Returns black or white, whichever has better contrast against the given\n * color.\n *\n * ```js\n * readableColor('white'); // '#000'\n * ```\n *\n * @param color The background color.\n * @returns `#000` or `#fff`.\n */\nfunction readableColor(color: string): string {\n  return readableColorIsBlack(color) ? '#000' : '#fff';\n}\n\nexport default readableColor;\n","import desaturate from './desaturate';\n\n/**\n * Saturates a color by adding to the saturation channel in HSL space.\n *\n * This is equivalent to `desaturate(color, -amount)`.\n *\n * ```js\n * saturate('hsl(0, 50%, 50%)', 0.1); // 'hsla(0, 60%, 50%, 1)'\n * ```\n *\n * @param color The input color.\n * @param amount The amount to saturate, given as a decimal between 0 and 1.\n * @returns The saturated color as an `hsla` string.\n */\nfunction saturate(color: string, amount: number): string {\n  return desaturate(color, -amount);\n}\n\nexport default saturate;\n","import parseToRgba from './parseToRgba';\nimport guard from './guard';\n\n/**\n * Converts a color to a hex color string.\n *\n * Includes an alpha channel when the input color is not fully opaque.\n *\n * ```js\n * toHex('palevioletred'); // '#db7093'\n * ```\n *\n * @param color The input color.\n * @returns A hex color string.\n */\nfunction toHex(color: string): string {\n  const [r, g, b, a] = parseToRgba(color);\n\n  let hex = (x: number) => {\n    const h = guard(0, 255, x).toString(16);\n    // NOTE: padStart could be used here but it breaks Node 6 compat\n    // https://github.com/ricokahler/color2k/issues/351\n    return h.length === 1 ? `0${h}` : h;\n  };\n\n  return `#${hex(r)}${hex(g)}${hex(b)}${a < 1 ? hex(Math.round(a * 255)) : ''}`;\n}\n\nexport default toHex;\n","import parseToRgba from './parseToRgba';\nimport rgba from './rgba';\n\n/**\n * Converts a color to an `rgba` color string.\n *\n * ```js\n * toRgba('midnightblue'); // 'rgba(25, 25, 112, 1)'\n * ```\n *\n * @param color The input color.\n * @returns An `rgba` color string.\n */\nfunction toRgba(color: string): string {\n  return rgba(...parseToRgba(color));\n}\n\nexport default toRgba;\n","import parseToHsla from './parseToHsla';\nimport hsla from './hsla';\n\n/**\n * Converts a color to an `hsla` color string.\n *\n * ```js\n * toHsla('peachpuff'); // 'hsla(28, 100%, 86%, 1)'\n * ```\n *\n * @param color The input color.\n * @returns An `hsla` color string.\n */\nfunction toHsla(color: string): string {\n  return hsla(...parseToHsla(color));\n}\n\nexport default toHsla;\n"],"names":["guard","low","high","value","Math","min","max","ColorError","Error","constructor","color","parseToRgba","input","trim","toLowerCase","namedColorRegex","test","hash","i","length","charCodeAt","colorMap","map","j","reducedHexMatch","reducedHexRegex","exec","arr","Array","from","slice","x","parseInt","r","hexMatch","hexRegex","rgbaMatch","rgbaRegex","parseFloat","hslaMatch","hslaRegex","h","s","l","a","hslToRgb","Number","isNaN","str","amount","join","RegExp","roundColor","round","hue","saturation","lightness","huePrime","chroma","abs","secondComponent","red","green","blue","lightnessModification","finalRed","finalGreen","finalBlue","parseToHsla","alpha","index","delta","hsla","wrapped","toFixed","adjustHue","degrees","complement","darken","desaturate","getLuminance","f","channel","pow","g","b","getContrast","color1","color2","luminance1","luminance2","rgba","mix","weight","normalize","n","r1","g1","b1","a1","r2","g2","b2","a2","alphaDelta","normalizedWeight","combinedWeight","weight2","weight1","getScale","colors","lastIndex","lowIndex","floor","highIndex","ceil","unit","guidelines","decorative","readable","aa","aaa","hasBadContrast","standard","background","invert","isFinite","RangeError","lighten","transparentize","opacify","readableColorIsBlack","readableColor","saturate","toHex","hex","toString","toRgba","toHsla"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAACC,GAAW,EAAEC,IAAY,EAAEC,KAAa,EAAU;AAC/D,EAAA,OAAOC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACL,GAAG,EAAEE,KAAK,CAAC,EAAED,IAAI,CAAC;AAC7C;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,UAAU,SAASC,KAAK,CAAC;EAC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