@digdir/designsystemet 0.1.0-alpha.11 → 0.1.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/bin/designsystemet.js +3388 -0
  2. package/dist/bin/designsystemet.js.map +1 -0
  3. package/dist/src/colors/colorUtils.js +210 -0
  4. package/dist/src/colors/colorUtils.js.map +1 -0
  5. package/dist/src/colors/index.js +451 -0
  6. package/dist/src/colors/index.js.map +1 -0
  7. package/dist/src/colors/themeUtils.js +311 -0
  8. package/dist/src/colors/themeUtils.js.map +1 -0
  9. package/dist/src/colors/types.js +1 -0
  10. package/dist/src/colors/types.js.map +1 -0
  11. package/dist/src/migrations/beta-to-v1.js +407 -0
  12. package/dist/src/migrations/beta-to-v1.js.map +1 -0
  13. package/dist/src/migrations/codemods/css/plugins.js +49 -0
  14. package/dist/src/migrations/codemods/css/plugins.js.map +1 -0
  15. package/dist/src/migrations/codemods/css/run.js +21 -0
  16. package/dist/src/migrations/codemods/css/run.js.map +1 -0
  17. package/dist/src/migrations/codemods/jsx/classname-prefix.js +65 -0
  18. package/dist/src/migrations/codemods/jsx/classname-prefix.js.map +1 -0
  19. package/dist/src/migrations/codemods/jsx/run.js +24 -0
  20. package/dist/src/migrations/codemods/jsx/run.js.map +1 -0
  21. package/dist/src/migrations/index.js +437 -0
  22. package/dist/src/migrations/index.js.map +1 -0
  23. package/dist/src/migrations/react-beta-to-v1.js +27 -0
  24. package/dist/src/migrations/react-beta-to-v1.js.map +1 -0
  25. package/dist/src/tokens/actions.js +2174 -0
  26. package/dist/src/tokens/actions.js.map +1 -0
  27. package/dist/src/tokens/build.js +2923 -0
  28. package/dist/src/tokens/build.js.map +1 -0
  29. package/dist/src/tokens/configs.js +2837 -0
  30. package/dist/src/tokens/configs.js.map +1 -0
  31. package/dist/src/tokens/formats/css-classes.js +2622 -0
  32. package/dist/src/tokens/formats/css-classes.js.map +1 -0
  33. package/dist/src/tokens/formats/css-variables.js +50 -0
  34. package/dist/src/tokens/formats/css-variables.js.map +1 -0
  35. package/dist/src/tokens/formats/js-tokens.js +38 -0
  36. package/dist/src/tokens/formats/js-tokens.js.map +1 -0
  37. package/dist/src/tokens/transformers.js +87 -0
  38. package/dist/src/tokens/transformers.js.map +1 -0
  39. package/dist/src/tokens/utils/noCase.js +30 -0
  40. package/dist/src/tokens/utils/noCase.js.map +1 -0
  41. package/dist/src/tokens/utils/permutateThemes.js +217 -0
  42. package/dist/src/tokens/utils/permutateThemes.js.map +1 -0
  43. package/dist/src/tokens/utils/utils.js +16 -0
  44. package/dist/src/tokens/utils/utils.js.map +1 -0
  45. package/package.json +23 -10
  46. package/LICENSE +0 -7
  47. package/dist/build/bin/designsystemet.js +0 -50
  48. package/dist/build/src/colors/colorUtils.js +0 -314
  49. package/dist/build/src/colors/index.js +0 -3
  50. package/dist/build/src/colors/themeUtils.js +0 -293
  51. package/dist/build/src/colors/types.js +0 -1
  52. package/dist/build/src/migrations/beta-to-v1.js +0 -341
  53. package/dist/build/src/migrations/codemods/css/plugins.js +0 -45
  54. package/dist/build/src/migrations/codemods/css/run.js +0 -17
  55. package/dist/build/src/migrations/codemods/jsx/classname-prefix.js +0 -80
  56. package/dist/build/src/migrations/codemods/jsx/run.js +0 -19
  57. package/dist/build/src/migrations/index.js +0 -6
  58. package/dist/build/src/migrations/react-beta-to-v1.js +0 -2
  59. package/dist/build/src/test/jsx-test.js +0 -10
  60. package/dist/build/src/tokens/actions.js +0 -20
  61. package/dist/build/src/tokens/build.js +0 -63
  62. package/dist/build/src/tokens/configs.js +0 -206
  63. package/dist/build/src/tokens/formats/css-classes.js +0 -78
  64. package/dist/build/src/tokens/formats/css-variables.js +0 -39
  65. package/dist/build/src/tokens/formats/js-tokens.js +0 -29
  66. package/dist/build/src/tokens/transformers.js +0 -42
  67. package/dist/build/src/tokens/utils/noCase.js +0 -30
  68. package/dist/build/src/tokens/utils/permutateThemes.js +0 -56
  69. package/dist/build/src/tokens/utils/utils.js +0 -21
  70. package/dist/build/tsconfig.tsbuildinfo +0 -1
  71. package/dist/types/bin/designsystemet.d.ts +0 -3
  72. package/dist/types/bin/designsystemet.d.ts.map +0 -1
  73. package/dist/types/src/colors/colorUtils.d.ts +0 -118
  74. package/dist/types/src/colors/colorUtils.d.ts.map +0 -1
  75. package/dist/types/src/colors/index.d.ts +0 -4
  76. package/dist/types/src/colors/index.d.ts.map +0 -1
  77. package/dist/types/src/colors/themeUtils.d.ts +0 -102
  78. package/dist/types/src/colors/themeUtils.d.ts.map +0 -1
  79. package/dist/types/src/colors/types.d.ts +0 -16
  80. package/dist/types/src/colors/types.d.ts.map +0 -1
  81. package/dist/types/src/migrations/beta-to-v1.d.ts +0 -3
  82. package/dist/types/src/migrations/beta-to-v1.d.ts.map +0 -1
  83. package/dist/types/src/migrations/codemods/css/plugins.d.ts +0 -6
  84. package/dist/types/src/migrations/codemods/css/plugins.d.ts.map +0 -1
  85. package/dist/types/src/migrations/codemods/css/run.d.ts +0 -8
  86. package/dist/types/src/migrations/codemods/css/run.d.ts.map +0 -1
  87. package/dist/types/src/migrations/codemods/jsx/classname-prefix.d.ts +0 -10
  88. package/dist/types/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
  89. package/dist/types/src/migrations/codemods/jsx/run.d.ts +0 -7
  90. package/dist/types/src/migrations/codemods/jsx/run.d.ts.map +0 -1
  91. package/dist/types/src/migrations/index.d.ts +0 -6
  92. package/dist/types/src/migrations/index.d.ts.map +0 -1
  93. package/dist/types/src/migrations/react-beta-to-v1.d.ts +0 -3
  94. package/dist/types/src/migrations/react-beta-to-v1.d.ts.map +0 -1
  95. package/dist/types/src/test/jsx-test.d.ts +0 -4
  96. package/dist/types/src/test/jsx-test.d.ts.map +0 -1
  97. package/dist/types/src/tokens/actions.d.ts +0 -3
  98. package/dist/types/src/tokens/actions.d.ts.map +0 -1
  99. package/dist/types/src/tokens/build.d.ts +0 -11
  100. package/dist/types/src/tokens/build.d.ts.map +0 -1
  101. package/dist/types/src/tokens/configs.d.ts +0 -26
  102. package/dist/types/src/tokens/configs.d.ts.map +0 -1
  103. package/dist/types/src/tokens/formats/css-classes.d.ts +0 -6
  104. package/dist/types/src/tokens/formats/css-classes.d.ts.map +0 -1
  105. package/dist/types/src/tokens/formats/css-variables.d.ts +0 -3
  106. package/dist/types/src/tokens/formats/css-variables.d.ts.map +0 -1
  107. package/dist/types/src/tokens/formats/js-tokens.d.ts +0 -6
  108. package/dist/types/src/tokens/formats/js-tokens.d.ts.map +0 -1
  109. package/dist/types/src/tokens/transformers.d.ts +0 -5
  110. package/dist/types/src/tokens/transformers.d.ts.map +0 -1
  111. package/dist/types/src/tokens/utils/noCase.d.ts +0 -11
  112. package/dist/types/src/tokens/utils/noCase.d.ts.map +0 -1
  113. package/dist/types/src/tokens/utils/permutateThemes.d.ts +0 -7
  114. package/dist/types/src/tokens/utils/permutateThemes.d.ts.map +0 -1
  115. package/dist/types/src/tokens/utils/utils.d.ts +0 -17
  116. package/dist/types/src/tokens/utils/utils.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/colors/colorUtils.ts","../../../src/colors/themeUtils.ts"],"sourcesContent":["import type { CssColor } from '@adobe/leonardo-contrast-colors';\nimport { Hsluv } from 'hsluv';\nimport chroma from 'chroma-js';\n\n/**\n * Converts a HEX color '#xxxxxx' into a CSS HSL string 'hsl(x,x,x)'\n *\n * @param hex A hex color string\n * @param valuesOnly If true, only the values are returned\n * @returns A CSS HSL string\n */\nexport const hexToCssHsl = (hex: string, valuesOnly = false) => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n let r = 0;\n let g = 0;\n let b = 0;\n let cssString = '';\n if (result) {\n r = parseInt(result[1], 16);\n g = parseInt(result[2], 16);\n b = parseInt(result[3], 16);\n }\n (r /= 255), (g /= 255), (b /= 255);\n const max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n let h,\n s,\n l = (max + min) / 2;\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n }\n\n h = Math.round(h ? h * 360 : 0);\n s = Math.round(s * 100);\n l = Math.round(l * 100);\n\n cssString = h + ',' + s + '%,' + l + '%';\n cssString = !valuesOnly ? 'hsl(' + cssString + ')' : cssString;\n\n return cssString;\n};\n\n/**\n * Converts a HEX string '#xxxxxx' into an array of HSL values '[h,s,l]'\n *\n * @param H A Hex color string\n * @returns HSL values in an array\n */\nexport const hexToHSL = (H: string) => {\n // Convert hex to RGB first\n let r = 0,\n g = 0,\n b = 0;\n if (H.length == 4) {\n r = parseInt('0x' + H[1] + H[1]);\n g = parseInt('0x' + H[2] + H[2]);\n b = parseInt('0x' + H[3] + H[3]);\n } else if (H.length == 7) {\n r = parseInt('0x' + H[1] + H[2]);\n g = parseInt('0x' + H[3] + H[4]);\n b = parseInt('0x' + H[5] + H[6]);\n }\n // Then to HSL\n r /= 255;\n g /= 255;\n b /= 255;\n let h = 0,\n s = 0,\n l = 0;\n const cmin = Math.min(r, g, b),\n cmax = Math.max(r, g, b),\n delta = cmax - cmin;\n\n if (delta == 0) h = 0;\n else if (cmax == r) h = ((g - b) / delta) % 6;\n else if (cmax == g) h = (b - r) / delta + 2;\n else h = (r - g) / delta + 4;\n\n h = Math.round(h * 60);\n\n if (h < 0) h += 360;\n\n l = (cmax + cmin) / 2;\n s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n\n return [h, s, l];\n};\n\n/**\n * Converts a HSL number array '[h,s,l]' into HSL CSS string 'hsl(x,x,x)'\n *\n * @param HSL A HSL number array '[h,s,l]'\n * @returns A hex color string\n */\nexport const hslArrToCss = (HSL: number[]) => {\n return 'hsl(' + HSL[0] + ',' + HSL[1] + '%,' + HSL[2] + '%)';\n};\n\n/**\n * Converts a HSL CSS string 'hsl(x,x,x)' into an array of HSL values '[h,s,l]'\n *\n * @param h The HSL hue\n * @param s The HSL saturation\n * @param l The HSL lightness\n * @returns HEX color string\n */\nexport const HSLToHex = (h: number, s: number, l: number) => {\n s /= 100;\n l /= 100;\n\n let r = 0,\n g = 0,\n b = 0;\n const c = (1 - Math.abs(2 * l - 1)) * s,\n x = c * (1 - Math.abs(((h / 60) % 2) - 1)),\n m = l - c / 2;\n\n if (0 <= h && h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (60 <= h && h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (120 <= h && h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (180 <= h && h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (240 <= h && h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (300 <= h && h < 360) {\n r = c;\n g = 0;\n b = x;\n }\n // Having obtained RGB, convert channels to hex\n r = parseInt(Math.round((r + m) * 255).toString(16), 16);\n g = parseInt(Math.round((g + m) * 255).toString(16), 16);\n b = parseInt(Math.round((b + m) * 255).toString(16), 16);\n\n // Prepend 0s, if necessary\n if (r.toString().length == 1) r = parseInt('0' + r.toString(), 10);\n if (g.toString().length == 1) g = parseInt('0' + g.toString(), 10);\n if (b.toString().length == 1) b = parseInt('0' + b.toString(), 10);\n\n return '#' + r + g + b;\n};\n\n/**\n * Converts a HEX color '#xxxxxx' into an array of RGB values '[R, G, B]'\n *\n * @param hex A hex color string\n * @returns RGB values in an array\n */\nexport const hexToRgb = (hex: string) => {\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function (m, r: string, g: string, b: string) {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null;\n};\n\n/**\n * Get the luminance of an RGB color\n *\n * @param r RGB red value\n * @param G RGB green value\n * @param b RGB blue value\n * @returns\n */\nexport const luminanceFromRgb = (r: string, g: string, b: string) => {\n const a = [Number(r), Number(g), Number(b)].map(function (v) {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n};\n\n/**\n * Get the luminance of a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const luminanceFromHex = (hex: CssColor) => {\n const rgb = hexToRgb(hex);\n if (rgb) {\n const r = rgb.r.toString();\n const g = rgb.g.toString();\n const b = rgb.b.toString();\n return luminanceFromRgb(r, g, b);\n }\n return 2;\n};\n\n/**\n * Get the contrast ratio between two luminance values\n *\n * @param lum1 The first luminance value\n * @param lum2 The second luminance value\n * @returns\n */\nexport const getRatioFromLum = (lum1: number, lum2: number) => {\n if (lum1 !== null && lum2 !== null) {\n return (Math.max(lum1, lum2) + 0.05) / (Math.min(lum1, lum2) + 0.05);\n } else {\n return -1;\n }\n};\n\n/**\n * Get the HSL lightness from a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const getHslLightessFromHex = (hex: CssColor) => {\n return chroma(hex).hsl()[2];\n};\n\nexport const getHslSaturationFromHex = (hex: CssColor) => {\n return chroma(hex).hsl()[1];\n};\n\n/**\n * Get the HSLuv lightness from a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const getLightnessFromHex = (hex: string) => {\n const conv = new Hsluv();\n conv.hex = hex;\n conv.hexToHsluv();\n return Number(conv.hsluv_l.toFixed(0));\n};\n\n/**\n * Get the contrast ratio between two HEX colors\n *\n * @param {CssColor} color1 The first color\n * @param {CssColor} color2 The second color\n * @returns\n */\nexport const getContrastFromHex = (color1: CssColor, color2: CssColor) => {\n const lum1 = luminanceFromHex(color1);\n const lum2 = luminanceFromHex(color2);\n if (lum1 !== null && lum2 !== null) {\n return getRatioFromLum(lum1, lum2);\n }\n return -1;\n};\n\n/**\n * Get the contrast ratio between two colors at a specific lightness\n *\n * @param lightness The lightness value\n * @param mainColor The main color\n * @param backgroundColor The background color\n * @returns The contrast ratio\n */\nexport const getContrastFromLightness = (lightness: number, mainColor: CssColor, backgroundColor: CssColor) => {\n const conv = new Hsluv();\n conv.hex = mainColor;\n conv.hexToHsluv();\n conv.hsluv_l = lightness;\n conv.hsluvToHex();\n const lightMainColor = conv.hex;\n const lum1 = luminanceFromHex(lightMainColor as CssColor);\n const lum2 = luminanceFromHex(backgroundColor);\n const ratio = getRatioFromLum(lum1 ?? 0, lum2 ?? 0);\n\n return ratio;\n};\n\n/**\n * Maps the numbers from [start1 - end1] to the range [start2 - end2], maintaining the proportionality between the numbers in the ranges using lineaer interpolation.\n */\n// const mapRange = (value: number, start1: number, end1: number, start2: number, end2: number) => {\n// return start2 + ((value - start1) * (end2 - start2)) / (end1 - start1);\n// };\n\n/**\n * Check if two colors have enough contrast to be used together\n *\n * @param {CssColor} color1 The first color\n * @param {CssColor} color2 The second color\n * @returns {boolean} If the colors have enough contrast\n */\nexport const areColorsContrasting = (color1: CssColor, color2: CssColor, type: 'text' | 'decorative' = 'text') => {\n const contrast = getContrastFromHex(color1, color2);\n if (contrast !== null) {\n if (type === 'text') {\n return contrast >= 4.5;\n } else {\n return contrast >= 3;\n }\n }\n return false;\n};\n\n/**\n * Check if aa string value is a HEX color\n *\n * @param {string} hex The string to check\n * @returns {boolean} If the string is a HEX color\n */\nexport const isHexColor = (hex: string) => {\n return typeof hex === 'string' && hex.length === 6 && !isNaN(Number('0x' + hex));\n};\n","import type { CssColor } from '@adobe/leonardo-contrast-colors';\nimport { BackgroundColor, Color, Theme } from '@adobe/leonardo-contrast-colors';\nimport { Hsluv } from 'hsluv';\n\nimport type { ContrastMode, Mode, ColorInfo, ColorNumber, ThemeInfo, ColorType } from './types';\nimport { getContrastFromHex, getContrastFromLightness, getLightnessFromHex } from './colorUtils';\n\nconst blueBaseColor = '#0A71C0';\nconst greenBaseColor = '#078D19';\nconst orangeBaseColor = '#CA5C21';\nconst purpleBaseColor = '#663299';\nconst redBaseColor = '#C01B1B';\nconst yellowBaseColor = '#EABF28';\n\nexport type ColorError = 'none' | 'decorative' | 'interaction';\n\ntype GlobalGenType = {\n themeMode?: Mode | 'all';\n contrastMode?: ContrastMode;\n};\n\ntype ThemeGenType = {\n colors: {\n accent: CssColor;\n neutral: CssColor;\n brand1: CssColor;\n brand2: CssColor;\n brand3: CssColor;\n };\n contrastMode?: ContrastMode;\n};\n\n/**\n * Generates a Leonardo theme color that is used to create a Leonardo Theme\n *\n * @param color CssColor\n * @param mode Light, Dark or Contrastmode\n * @param contrastMode Contrast mode\n * @returns\n */\nconst generateThemeColor = (color: CssColor, mode: Mode, contrastMode: 'aa' | 'aaa' = 'aa') => {\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n let colorLightness = getLightnessFromHex(color);\n if (mode === 'dark' || mode === 'contrast') {\n color = getBaseColor(color);\n colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;\n }\n\n const multiplier = colorLightness <= 30 ? -8 : 8;\n const baseDefaultContrast = getContrastFromLightness(colorLightness, color, leoBackgroundColor.colorKeys[0]);\n const baseHoverContrast = getContrastFromLightness(\n colorLightness - multiplier,\n color,\n leoBackgroundColor.colorKeys[0],\n );\n const baseActiveContrast = getContrastFromLightness(\n colorLightness - multiplier * 2,\n color,\n leoBackgroundColor.colorKeys[0],\n );\n\n const textSubLightLightness = contrastMode === 'aa' ? 42 : 30;\n const textDefLightLightness = contrastMode === 'aa' ? 20 : 17;\n\n const textSubDarkLightness = contrastMode === 'aa' ? 65 : 78;\n const textDefDarkLightness = contrastMode === 'aa' ? 89 : 93;\n\n let lightnessScale: number[] = [];\n\n if (mode === 'light') {\n lightnessScale = [100, 96, 90, 84, 78, 76, 54, 33, textSubLightLightness, textDefLightLightness];\n } else if (mode === 'dark') {\n lightnessScale = [10, 14, 20, 26, 32, 35, 47, 77, textSubDarkLightness, textDefDarkLightness];\n } else {\n lightnessScale = [1, 6, 14, 20, 26, 58, 70, 82, 80, 95];\n }\n\n const getColorContrasts = (color: CssColor, lightnessScale: number[], backgroundColor: CssColor) => {\n return lightnessScale.map((lightness) => getContrastFromLightness(lightness, color, backgroundColor));\n };\n\n return new Color({\n name: 'color',\n colorKeys: [color],\n ratios: [\n ...getColorContrasts(color, lightnessScale.slice(0, 8), leoBackgroundColor.colorKeys[0]),\n baseDefaultContrast,\n baseHoverContrast,\n baseActiveContrast,\n ...getColorContrasts(color, lightnessScale.slice(8), leoBackgroundColor.colorKeys[0]),\n ],\n });\n};\n\n/**\n *\n * Generates a color scale based on a base color and a mode.\n *\n * @param color The base color that is used to generate the color scale\n * @param mode The mode of the theme\n */\nexport const generateScaleForColor = (color: CssColor, mode: Mode, contrastMode: 'aa' | 'aaa' = 'aa'): ColorInfo[] => {\n const themeColor = generateThemeColor(color, mode, contrastMode);\n\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n\n const theme = new Theme({\n colors: [themeColor],\n backgroundColor: leoBackgroundColor,\n lightness: 100,\n });\n\n const outputArray: ColorInfo[] = [];\n for (let i = 0; i < theme.contrastColorValues.length; i++) {\n outputArray.push({\n hex: theme.contrastColorValues[i],\n number: (i + 1) as ColorNumber,\n name: getColorNameFromNumber((i + 1) as ColorNumber),\n });\n }\n outputArray.push({\n hex: calculateContrastOneColor(theme.contrastColorValues[8]),\n number: 14,\n name: getColorNameFromNumber(14),\n });\n outputArray.push({\n hex: calculateContrastTwoColor(theme.contrastColorValues[8]),\n number: 15,\n name: getColorNameFromNumber(15),\n });\n\n if (mode === 'light') {\n outputArray[8].hex = color;\n }\n\n return outputArray;\n};\n\n/**\n *\n * Generates a color theme based on a base color. Light, Dark and Contrast scales are includes.\n *\n * @param color The base color that is used to generate the color theme\n */\nexport const generateThemeForColor = (color: CssColor, contrastMode: 'aa' | 'aaa' = 'aa') => {\n const lightScale = generateScaleForColor(color, 'light', contrastMode);\n const darkScale = generateScaleForColor(color, 'dark', contrastMode);\n const contrastScale = generateScaleForColor(color, 'contrast', contrastMode);\n\n return {\n light: lightScale,\n dark: darkScale,\n contrast: contrastScale,\n } as ThemeInfo;\n};\n\nexport const generateGlobalColors = ({ contrastMode = 'aa' }: GlobalGenType) => {\n const blueTheme = generateThemeForColor(blueBaseColor, contrastMode);\n const greenTheme = generateThemeForColor(greenBaseColor, contrastMode);\n const orangeTheme = generateThemeForColor(orangeBaseColor, contrastMode);\n const purpleTheme = generateThemeForColor(purpleBaseColor, contrastMode);\n const redTheme = generateThemeForColor(redBaseColor, contrastMode);\n const yellowTheme = generateThemeForColor(yellowBaseColor, contrastMode);\n\n return {\n blue: blueTheme,\n green: greenTheme,\n orange: orangeTheme,\n purple: purpleTheme,\n red: redTheme,\n yellow: yellowTheme,\n };\n};\n\n/**\n * This function generates a complete theme for a set of colors.\n *\n * @param colors Which colors to generate the theme for\n * @param contrastMode The contrast mode to use\n * @returns\n */\nexport const generateColorTheme = ({ colors, contrastMode = 'aa' }: ThemeGenType) => {\n const accentTheme = generateThemeForColor(colors.accent, contrastMode);\n const neutralTheme = generateThemeForColor(colors.neutral, contrastMode);\n const brand1Theme = generateThemeForColor(colors.brand1, contrastMode);\n const brand2Theme = generateThemeForColor(colors.brand2, contrastMode);\n const brand3Theme = generateThemeForColor(colors.brand3, contrastMode);\n\n return {\n accent: accentTheme,\n neutral: neutralTheme,\n brand1: brand1Theme,\n brand2: brand2Theme,\n brand3: brand3Theme,\n };\n};\n\n/**\n *\n * This function calculates a color that can be used as a strong contrast color to a base color.\n *\n * @param baseColor The base color\n */\nexport const calculateContrastOneColor = (baseColor: CssColor) => {\n const contrastWhite = getContrastFromHex(baseColor, '#ffffff');\n const contrastBlack = getContrastFromHex(baseColor, '#000000');\n const lightness = contrastWhite >= contrastBlack ? 100 : 0;\n // const color = createColorWithLightness(baseColor, lightness);\n\n return lightness === 0 ? '#000000' : '#ffffff';\n};\n\n/**\n *\n * This function calculates a color that can be used as a subtle contrast color to a base color.\n *\n * @param color The base color\n */\nexport const calculateContrastTwoColor = (color: CssColor) => {\n const contrastWhite = getContrastFromHex(color, '#ffffff');\n const contrastBlack = getContrastFromHex(color, '#000000');\n const lightness = getLightnessFromHex(color);\n const doubleALightnessModifier = lightness <= 40 ? 60 : lightness >= 60 ? 60 : 50;\n\n let targetLightness = 0;\n const contrastDirection = contrastWhite >= contrastBlack ? 'lighten' : 'darken';\n\n targetLightness =\n contrastDirection === 'lighten' ? lightness + doubleALightnessModifier : lightness - doubleALightnessModifier;\n\n return createColorWithLightness(color, targetLightness);\n};\n\n/**\n *\n * This function checks if white or black text can be used on 2 different colors at 4.5:1 contrast.\n *\n * @param baseDefaultColor Base default color\n * @param baseActiveColor Base active color\n */\nexport const canTextBeUsedOnColors = (baseDefaultColor: CssColor, baseActiveColor: CssColor) => {\n const defaultAgainstWhite = getContrastFromHex(baseDefaultColor, '#ffffff');\n const defaultAgainstBlack = getContrastFromHex(baseDefaultColor, '#000000');\n\n const activeAgainstWhite = getContrastFromHex(baseActiveColor, '#ffffff');\n const activeAgainstBlack = getContrastFromHex(baseActiveColor, '#000000');\n\n if (defaultAgainstWhite >= 4.5 && activeAgainstWhite >= 4.5) {\n return true;\n } else if (defaultAgainstBlack >= 4.5 && activeAgainstBlack >= 4.5) {\n return true;\n }\n\n return false;\n};\n\n/**\n *\n * This function creates a color with a specific lightness value.\n *\n * @param color The base color\n * @param lightness The lightness value from 0 to 100\n */\nexport const createColorWithLightness = (color: CssColor, lightness: number) => {\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n const colors = new Color({\n name: 'color',\n colorKeys: [color],\n ratios: [getContrastFromLightness(lightness, color, '#ffffff')],\n });\n\n const theme = new Theme({\n colors: [colors],\n backgroundColor: leoBackgroundColor,\n lightness: 100,\n });\n return theme.contrastColorValues[0];\n};\n\n/**\n *\n * This function returns the color number based on the color name.\n *\n * @param name The name of the color\n */\nexport const getColorNumberFromName = (name: string): ColorNumber => {\n const colorMap: { [key: string]: ColorNumber } = {\n 'Background Subtle': 1,\n 'Background Default': 2,\n 'Surface Default': 3,\n 'Surface Hover': 4,\n 'Surface Active': 5,\n 'Border Subtle': 6,\n 'Border Default': 7,\n 'Border Strong': 8,\n 'Base Default': 9,\n 'Base Hover': 10,\n 'Base Active': 11,\n 'Text Subtle': 12,\n 'Text Default': 13,\n };\n return colorMap[name];\n};\n\n/**\n *\n * This function returns the color name based on the color number.\n *\n * @param number The number of the color\n */\nexport const getColorNameFromNumber = (number: ColorNumber): string => {\n const colorMap: { [key in ColorNumber]: string } = {\n 1: 'Background Subtle',\n 2: 'Background Default',\n 3: 'Surface Default',\n 4: 'Surface Hover',\n 5: 'Surface Active',\n 6: 'Border Subtle',\n 7: 'Border Default',\n 8: 'Border Strong',\n 9: 'Base Default',\n 10: 'Base Hover',\n 11: 'Base Active',\n 12: 'Text Subtle',\n 13: 'Text Default',\n 14: 'Contrast Default',\n 15: 'Contrast Subtle',\n };\n return colorMap[number];\n};\n\nexport const getBaseColor = (color: CssColor) => {\n const conv = new Hsluv();\n conv.hex = color;\n conv.hexToHsluv();\n // conv.hsluv_l = 100 - conv.hsluv_l;\n // conv.hsluv_s = getSaturationForDarkMode(color, conv.hsluv_s);\n conv.hsluvToHex();\n\n return conv.hex as CssColor;\n};\n\nexport const getCssVariable = (colorType: ColorType, colorNumber: ColorNumber) => {\n return `--ds-${colorType}-${getColorNameFromNumber(colorNumber).toLowerCase().replace(/\\s/g, '-')}`;\n};\n"],"mappings":";AACA,SAAS,aAAa;AACtB,OAAO,YAAY;AASZ,IAAM,cAAc,CAAC,KAAa,aAAa,UAAU;AAC9D,QAAM,SAAS,4CAA4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AM;AAAA,IACf,iBAAiB;AAAA,IACjB,WAAW;AAAA,EACb,CAAC;AACD,SAAO,MAAM,oBAAoB,CAAC;AACpC;AAQO,IAAM,yBAAyB,CAAC,SAA8B;AACnE,QAAM,WAA2C;AAAA,IAC/C,qBAAqB;AAAA,IACrB,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,eAAe;AAAA,IACf,gBAAgB;AAAA,EAClB;AACA,SAAO,SAAS,IAAI;AACtB;AAQO,IAAM,yBAAyB,CAAC,WAAgC;AACrE,QAAM,WAA6C;AAAA,IACjD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AACA,SAAO,SAAS,MAAM;AACxB;AAEO,IAAM,eAAe,CAAC,UAAoB;AAC/C,QAAM,OAAO,IAAIE,OAAM;AACvB,OAAK,MAAM;AACX,OAAK,WAAW;AAGhB,OAAK,WAAW;AAEhB,SAAO,KAAK;AACd;AAEO,IAAM,iBAAiB,CAAC,WAAsB,gBAA6B;AAChF,SAAO,QAAQ,SAAS,IAAI,uBAAuB,WAAW,EAAE,YAAY,EAAE,QAAQ,OAAO,GAAG,CAAC;AACnG;","names":["Hsluv","color","lightnessScale","Hsluv"]}
@@ -0,0 +1,311 @@
1
+ // src/colors/themeUtils.ts
2
+ import { BackgroundColor, Color, Theme } from "@adobe/leonardo-contrast-colors";
3
+ import { Hsluv as Hsluv2 } from "hsluv";
4
+
5
+ // src/colors/colorUtils.ts
6
+ import { Hsluv } from "hsluv";
7
+ import chroma from "chroma-js";
8
+ var hexToRgb = (hex) => {
9
+ const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
10
+ hex = hex.replace(shorthandRegex, function(m, r, g, b) {
11
+ return r + r + g + g + b + b;
12
+ });
13
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
14
+ return result ? {
15
+ r: parseInt(result[1], 16),
16
+ g: parseInt(result[2], 16),
17
+ b: parseInt(result[3], 16)
18
+ } : null;
19
+ };
20
+ var luminanceFromRgb = (r, g, b) => {
21
+ const a = [Number(r), Number(g), Number(b)].map(function(v) {
22
+ v /= 255;
23
+ return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
24
+ });
25
+ return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
26
+ };
27
+ var luminanceFromHex = (hex) => {
28
+ const rgb = hexToRgb(hex);
29
+ if (rgb) {
30
+ const r = rgb.r.toString();
31
+ const g = rgb.g.toString();
32
+ const b = rgb.b.toString();
33
+ return luminanceFromRgb(r, g, b);
34
+ }
35
+ return 2;
36
+ };
37
+ var getRatioFromLum = (lum1, lum2) => {
38
+ if (lum1 !== null && lum2 !== null) {
39
+ return (Math.max(lum1, lum2) + 0.05) / (Math.min(lum1, lum2) + 0.05);
40
+ } else {
41
+ return -1;
42
+ }
43
+ };
44
+ var getLightnessFromHex = (hex) => {
45
+ const conv = new Hsluv();
46
+ conv.hex = hex;
47
+ conv.hexToHsluv();
48
+ return Number(conv.hsluv_l.toFixed(0));
49
+ };
50
+ var getContrastFromHex = (color1, color2) => {
51
+ const lum1 = luminanceFromHex(color1);
52
+ const lum2 = luminanceFromHex(color2);
53
+ if (lum1 !== null && lum2 !== null) {
54
+ return getRatioFromLum(lum1, lum2);
55
+ }
56
+ return -1;
57
+ };
58
+ var getContrastFromLightness = (lightness, mainColor, backgroundColor) => {
59
+ const conv = new Hsluv();
60
+ conv.hex = mainColor;
61
+ conv.hexToHsluv();
62
+ conv.hsluv_l = lightness;
63
+ conv.hsluvToHex();
64
+ const lightMainColor = conv.hex;
65
+ const lum1 = luminanceFromHex(lightMainColor);
66
+ const lum2 = luminanceFromHex(backgroundColor);
67
+ const ratio = getRatioFromLum(lum1 ?? 0, lum2 ?? 0);
68
+ return ratio;
69
+ };
70
+
71
+ // src/colors/themeUtils.ts
72
+ var blueBaseColor = "#0A71C0";
73
+ var greenBaseColor = "#078D19";
74
+ var orangeBaseColor = "#CA5C21";
75
+ var purpleBaseColor = "#663299";
76
+ var redBaseColor = "#C01B1B";
77
+ var yellowBaseColor = "#EABF28";
78
+ var generateThemeColor = (color, mode, contrastMode = "aa") => {
79
+ const leoBackgroundColor = new BackgroundColor({
80
+ name: "backgroundColor",
81
+ colorKeys: ["#ffffff"],
82
+ ratios: [1]
83
+ });
84
+ let colorLightness = getLightnessFromHex(color);
85
+ if (mode === "dark" || mode === "contrast") {
86
+ color = getBaseColor(color);
87
+ colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
88
+ }
89
+ const multiplier = colorLightness <= 30 ? -8 : 8;
90
+ const baseDefaultContrast = getContrastFromLightness(colorLightness, color, leoBackgroundColor.colorKeys[0]);
91
+ const baseHoverContrast = getContrastFromLightness(
92
+ colorLightness - multiplier,
93
+ color,
94
+ leoBackgroundColor.colorKeys[0]
95
+ );
96
+ const baseActiveContrast = getContrastFromLightness(
97
+ colorLightness - multiplier * 2,
98
+ color,
99
+ leoBackgroundColor.colorKeys[0]
100
+ );
101
+ const textSubLightLightness = contrastMode === "aa" ? 42 : 30;
102
+ const textDefLightLightness = contrastMode === "aa" ? 20 : 17;
103
+ const textSubDarkLightness = contrastMode === "aa" ? 65 : 78;
104
+ const textDefDarkLightness = contrastMode === "aa" ? 89 : 93;
105
+ let lightnessScale = [];
106
+ if (mode === "light") {
107
+ lightnessScale = [100, 96, 90, 84, 78, 76, 54, 33, textSubLightLightness, textDefLightLightness];
108
+ } else if (mode === "dark") {
109
+ lightnessScale = [10, 14, 20, 26, 32, 35, 47, 77, textSubDarkLightness, textDefDarkLightness];
110
+ } else {
111
+ lightnessScale = [1, 6, 14, 20, 26, 58, 70, 82, 80, 95];
112
+ }
113
+ const getColorContrasts = (color2, lightnessScale2, backgroundColor) => {
114
+ return lightnessScale2.map((lightness) => getContrastFromLightness(lightness, color2, backgroundColor));
115
+ };
116
+ return new Color({
117
+ name: "color",
118
+ colorKeys: [color],
119
+ ratios: [
120
+ ...getColorContrasts(color, lightnessScale.slice(0, 8), leoBackgroundColor.colorKeys[0]),
121
+ baseDefaultContrast,
122
+ baseHoverContrast,
123
+ baseActiveContrast,
124
+ ...getColorContrasts(color, lightnessScale.slice(8), leoBackgroundColor.colorKeys[0])
125
+ ]
126
+ });
127
+ };
128
+ var generateScaleForColor = (color, mode, contrastMode = "aa") => {
129
+ const themeColor = generateThemeColor(color, mode, contrastMode);
130
+ const leoBackgroundColor = new BackgroundColor({
131
+ name: "backgroundColor",
132
+ colorKeys: ["#ffffff"],
133
+ ratios: [1]
134
+ });
135
+ const theme = new Theme({
136
+ colors: [themeColor],
137
+ backgroundColor: leoBackgroundColor,
138
+ lightness: 100
139
+ });
140
+ const outputArray = [];
141
+ for (let i = 0; i < theme.contrastColorValues.length; i++) {
142
+ outputArray.push({
143
+ hex: theme.contrastColorValues[i],
144
+ number: i + 1,
145
+ name: getColorNameFromNumber(i + 1)
146
+ });
147
+ }
148
+ outputArray.push({
149
+ hex: calculateContrastOneColor(theme.contrastColorValues[8]),
150
+ number: 14,
151
+ name: getColorNameFromNumber(14)
152
+ });
153
+ outputArray.push({
154
+ hex: calculateContrastTwoColor(theme.contrastColorValues[8]),
155
+ number: 15,
156
+ name: getColorNameFromNumber(15)
157
+ });
158
+ if (mode === "light") {
159
+ outputArray[8].hex = color;
160
+ }
161
+ return outputArray;
162
+ };
163
+ var generateThemeForColor = (color, contrastMode = "aa") => {
164
+ const lightScale = generateScaleForColor(color, "light", contrastMode);
165
+ const darkScale = generateScaleForColor(color, "dark", contrastMode);
166
+ const contrastScale = generateScaleForColor(color, "contrast", contrastMode);
167
+ return {
168
+ light: lightScale,
169
+ dark: darkScale,
170
+ contrast: contrastScale
171
+ };
172
+ };
173
+ var generateGlobalColors = ({ contrastMode = "aa" }) => {
174
+ const blueTheme = generateThemeForColor(blueBaseColor, contrastMode);
175
+ const greenTheme = generateThemeForColor(greenBaseColor, contrastMode);
176
+ const orangeTheme = generateThemeForColor(orangeBaseColor, contrastMode);
177
+ const purpleTheme = generateThemeForColor(purpleBaseColor, contrastMode);
178
+ const redTheme = generateThemeForColor(redBaseColor, contrastMode);
179
+ const yellowTheme = generateThemeForColor(yellowBaseColor, contrastMode);
180
+ return {
181
+ blue: blueTheme,
182
+ green: greenTheme,
183
+ orange: orangeTheme,
184
+ purple: purpleTheme,
185
+ red: redTheme,
186
+ yellow: yellowTheme
187
+ };
188
+ };
189
+ var generateColorTheme = ({ colors, contrastMode = "aa" }) => {
190
+ const accentTheme = generateThemeForColor(colors.accent, contrastMode);
191
+ const neutralTheme = generateThemeForColor(colors.neutral, contrastMode);
192
+ const brand1Theme = generateThemeForColor(colors.brand1, contrastMode);
193
+ const brand2Theme = generateThemeForColor(colors.brand2, contrastMode);
194
+ const brand3Theme = generateThemeForColor(colors.brand3, contrastMode);
195
+ return {
196
+ accent: accentTheme,
197
+ neutral: neutralTheme,
198
+ brand1: brand1Theme,
199
+ brand2: brand2Theme,
200
+ brand3: brand3Theme
201
+ };
202
+ };
203
+ var calculateContrastOneColor = (baseColor) => {
204
+ const contrastWhite = getContrastFromHex(baseColor, "#ffffff");
205
+ const contrastBlack = getContrastFromHex(baseColor, "#000000");
206
+ const lightness = contrastWhite >= contrastBlack ? 100 : 0;
207
+ return lightness === 0 ? "#000000" : "#ffffff";
208
+ };
209
+ var calculateContrastTwoColor = (color) => {
210
+ const contrastWhite = getContrastFromHex(color, "#ffffff");
211
+ const contrastBlack = getContrastFromHex(color, "#000000");
212
+ const lightness = getLightnessFromHex(color);
213
+ const doubleALightnessModifier = lightness <= 40 ? 60 : lightness >= 60 ? 60 : 50;
214
+ let targetLightness = 0;
215
+ const contrastDirection = contrastWhite >= contrastBlack ? "lighten" : "darken";
216
+ targetLightness = contrastDirection === "lighten" ? lightness + doubleALightnessModifier : lightness - doubleALightnessModifier;
217
+ return createColorWithLightness(color, targetLightness);
218
+ };
219
+ var canTextBeUsedOnColors = (baseDefaultColor, baseActiveColor) => {
220
+ const defaultAgainstWhite = getContrastFromHex(baseDefaultColor, "#ffffff");
221
+ const defaultAgainstBlack = getContrastFromHex(baseDefaultColor, "#000000");
222
+ const activeAgainstWhite = getContrastFromHex(baseActiveColor, "#ffffff");
223
+ const activeAgainstBlack = getContrastFromHex(baseActiveColor, "#000000");
224
+ if (defaultAgainstWhite >= 4.5 && activeAgainstWhite >= 4.5) {
225
+ return true;
226
+ } else if (defaultAgainstBlack >= 4.5 && activeAgainstBlack >= 4.5) {
227
+ return true;
228
+ }
229
+ return false;
230
+ };
231
+ var createColorWithLightness = (color, lightness) => {
232
+ const leoBackgroundColor = new BackgroundColor({
233
+ name: "backgroundColor",
234
+ colorKeys: ["#ffffff"],
235
+ ratios: [1]
236
+ });
237
+ const colors = new Color({
238
+ name: "color",
239
+ colorKeys: [color],
240
+ ratios: [getContrastFromLightness(lightness, color, "#ffffff")]
241
+ });
242
+ const theme = new Theme({
243
+ colors: [colors],
244
+ backgroundColor: leoBackgroundColor,
245
+ lightness: 100
246
+ });
247
+ return theme.contrastColorValues[0];
248
+ };
249
+ var getColorNumberFromName = (name) => {
250
+ const colorMap = {
251
+ "Background Subtle": 1,
252
+ "Background Default": 2,
253
+ "Surface Default": 3,
254
+ "Surface Hover": 4,
255
+ "Surface Active": 5,
256
+ "Border Subtle": 6,
257
+ "Border Default": 7,
258
+ "Border Strong": 8,
259
+ "Base Default": 9,
260
+ "Base Hover": 10,
261
+ "Base Active": 11,
262
+ "Text Subtle": 12,
263
+ "Text Default": 13
264
+ };
265
+ return colorMap[name];
266
+ };
267
+ var getColorNameFromNumber = (number) => {
268
+ const colorMap = {
269
+ 1: "Background Subtle",
270
+ 2: "Background Default",
271
+ 3: "Surface Default",
272
+ 4: "Surface Hover",
273
+ 5: "Surface Active",
274
+ 6: "Border Subtle",
275
+ 7: "Border Default",
276
+ 8: "Border Strong",
277
+ 9: "Base Default",
278
+ 10: "Base Hover",
279
+ 11: "Base Active",
280
+ 12: "Text Subtle",
281
+ 13: "Text Default",
282
+ 14: "Contrast Default",
283
+ 15: "Contrast Subtle"
284
+ };
285
+ return colorMap[number];
286
+ };
287
+ var getBaseColor = (color) => {
288
+ const conv = new Hsluv2();
289
+ conv.hex = color;
290
+ conv.hexToHsluv();
291
+ conv.hsluvToHex();
292
+ return conv.hex;
293
+ };
294
+ var getCssVariable = (colorType, colorNumber) => {
295
+ return `--ds-${colorType}-${getColorNameFromNumber(colorNumber).toLowerCase().replace(/\s/g, "-")}`;
296
+ };
297
+ export {
298
+ calculateContrastOneColor,
299
+ calculateContrastTwoColor,
300
+ canTextBeUsedOnColors,
301
+ createColorWithLightness,
302
+ generateColorTheme,
303
+ generateGlobalColors,
304
+ generateScaleForColor,
305
+ generateThemeForColor,
306
+ getBaseColor,
307
+ getColorNameFromNumber,
308
+ getColorNumberFromName,
309
+ getCssVariable
310
+ };
311
+ //# sourceMappingURL=themeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/colors/themeUtils.ts","../../../src/colors/colorUtils.ts"],"sourcesContent":["import type { CssColor } from '@adobe/leonardo-contrast-colors';\nimport { BackgroundColor, Color, Theme } from '@adobe/leonardo-contrast-colors';\nimport { Hsluv } from 'hsluv';\n\nimport type { ContrastMode, Mode, ColorInfo, ColorNumber, ThemeInfo, ColorType } from './types';\nimport { getContrastFromHex, getContrastFromLightness, getLightnessFromHex } from './colorUtils';\n\nconst blueBaseColor = '#0A71C0';\nconst greenBaseColor = '#078D19';\nconst orangeBaseColor = '#CA5C21';\nconst purpleBaseColor = '#663299';\nconst redBaseColor = '#C01B1B';\nconst yellowBaseColor = '#EABF28';\n\nexport type ColorError = 'none' | 'decorative' | 'interaction';\n\ntype GlobalGenType = {\n themeMode?: Mode | 'all';\n contrastMode?: ContrastMode;\n};\n\ntype ThemeGenType = {\n colors: {\n accent: CssColor;\n neutral: CssColor;\n brand1: CssColor;\n brand2: CssColor;\n brand3: CssColor;\n };\n contrastMode?: ContrastMode;\n};\n\n/**\n * Generates a Leonardo theme color that is used to create a Leonardo Theme\n *\n * @param color CssColor\n * @param mode Light, Dark or Contrastmode\n * @param contrastMode Contrast mode\n * @returns\n */\nconst generateThemeColor = (color: CssColor, mode: Mode, contrastMode: 'aa' | 'aaa' = 'aa') => {\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n let colorLightness = getLightnessFromHex(color);\n if (mode === 'dark' || mode === 'contrast') {\n color = getBaseColor(color);\n colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;\n }\n\n const multiplier = colorLightness <= 30 ? -8 : 8;\n const baseDefaultContrast = getContrastFromLightness(colorLightness, color, leoBackgroundColor.colorKeys[0]);\n const baseHoverContrast = getContrastFromLightness(\n colorLightness - multiplier,\n color,\n leoBackgroundColor.colorKeys[0],\n );\n const baseActiveContrast = getContrastFromLightness(\n colorLightness - multiplier * 2,\n color,\n leoBackgroundColor.colorKeys[0],\n );\n\n const textSubLightLightness = contrastMode === 'aa' ? 42 : 30;\n const textDefLightLightness = contrastMode === 'aa' ? 20 : 17;\n\n const textSubDarkLightness = contrastMode === 'aa' ? 65 : 78;\n const textDefDarkLightness = contrastMode === 'aa' ? 89 : 93;\n\n let lightnessScale: number[] = [];\n\n if (mode === 'light') {\n lightnessScale = [100, 96, 90, 84, 78, 76, 54, 33, textSubLightLightness, textDefLightLightness];\n } else if (mode === 'dark') {\n lightnessScale = [10, 14, 20, 26, 32, 35, 47, 77, textSubDarkLightness, textDefDarkLightness];\n } else {\n lightnessScale = [1, 6, 14, 20, 26, 58, 70, 82, 80, 95];\n }\n\n const getColorContrasts = (color: CssColor, lightnessScale: number[], backgroundColor: CssColor) => {\n return lightnessScale.map((lightness) => getContrastFromLightness(lightness, color, backgroundColor));\n };\n\n return new Color({\n name: 'color',\n colorKeys: [color],\n ratios: [\n ...getColorContrasts(color, lightnessScale.slice(0, 8), leoBackgroundColor.colorKeys[0]),\n baseDefaultContrast,\n baseHoverContrast,\n baseActiveContrast,\n ...getColorContrasts(color, lightnessScale.slice(8), leoBackgroundColor.colorKeys[0]),\n ],\n });\n};\n\n/**\n *\n * Generates a color scale based on a base color and a mode.\n *\n * @param color The base color that is used to generate the color scale\n * @param mode The mode of the theme\n */\nexport const generateScaleForColor = (color: CssColor, mode: Mode, contrastMode: 'aa' | 'aaa' = 'aa'): ColorInfo[] => {\n const themeColor = generateThemeColor(color, mode, contrastMode);\n\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n\n const theme = new Theme({\n colors: [themeColor],\n backgroundColor: leoBackgroundColor,\n lightness: 100,\n });\n\n const outputArray: ColorInfo[] = [];\n for (let i = 0; i < theme.contrastColorValues.length; i++) {\n outputArray.push({\n hex: theme.contrastColorValues[i],\n number: (i + 1) as ColorNumber,\n name: getColorNameFromNumber((i + 1) as ColorNumber),\n });\n }\n outputArray.push({\n hex: calculateContrastOneColor(theme.contrastColorValues[8]),\n number: 14,\n name: getColorNameFromNumber(14),\n });\n outputArray.push({\n hex: calculateContrastTwoColor(theme.contrastColorValues[8]),\n number: 15,\n name: getColorNameFromNumber(15),\n });\n\n if (mode === 'light') {\n outputArray[8].hex = color;\n }\n\n return outputArray;\n};\n\n/**\n *\n * Generates a color theme based on a base color. Light, Dark and Contrast scales are includes.\n *\n * @param color The base color that is used to generate the color theme\n */\nexport const generateThemeForColor = (color: CssColor, contrastMode: 'aa' | 'aaa' = 'aa') => {\n const lightScale = generateScaleForColor(color, 'light', contrastMode);\n const darkScale = generateScaleForColor(color, 'dark', contrastMode);\n const contrastScale = generateScaleForColor(color, 'contrast', contrastMode);\n\n return {\n light: lightScale,\n dark: darkScale,\n contrast: contrastScale,\n } as ThemeInfo;\n};\n\nexport const generateGlobalColors = ({ contrastMode = 'aa' }: GlobalGenType) => {\n const blueTheme = generateThemeForColor(blueBaseColor, contrastMode);\n const greenTheme = generateThemeForColor(greenBaseColor, contrastMode);\n const orangeTheme = generateThemeForColor(orangeBaseColor, contrastMode);\n const purpleTheme = generateThemeForColor(purpleBaseColor, contrastMode);\n const redTheme = generateThemeForColor(redBaseColor, contrastMode);\n const yellowTheme = generateThemeForColor(yellowBaseColor, contrastMode);\n\n return {\n blue: blueTheme,\n green: greenTheme,\n orange: orangeTheme,\n purple: purpleTheme,\n red: redTheme,\n yellow: yellowTheme,\n };\n};\n\n/**\n * This function generates a complete theme for a set of colors.\n *\n * @param colors Which colors to generate the theme for\n * @param contrastMode The contrast mode to use\n * @returns\n */\nexport const generateColorTheme = ({ colors, contrastMode = 'aa' }: ThemeGenType) => {\n const accentTheme = generateThemeForColor(colors.accent, contrastMode);\n const neutralTheme = generateThemeForColor(colors.neutral, contrastMode);\n const brand1Theme = generateThemeForColor(colors.brand1, contrastMode);\n const brand2Theme = generateThemeForColor(colors.brand2, contrastMode);\n const brand3Theme = generateThemeForColor(colors.brand3, contrastMode);\n\n return {\n accent: accentTheme,\n neutral: neutralTheme,\n brand1: brand1Theme,\n brand2: brand2Theme,\n brand3: brand3Theme,\n };\n};\n\n/**\n *\n * This function calculates a color that can be used as a strong contrast color to a base color.\n *\n * @param baseColor The base color\n */\nexport const calculateContrastOneColor = (baseColor: CssColor) => {\n const contrastWhite = getContrastFromHex(baseColor, '#ffffff');\n const contrastBlack = getContrastFromHex(baseColor, '#000000');\n const lightness = contrastWhite >= contrastBlack ? 100 : 0;\n // const color = createColorWithLightness(baseColor, lightness);\n\n return lightness === 0 ? '#000000' : '#ffffff';\n};\n\n/**\n *\n * This function calculates a color that can be used as a subtle contrast color to a base color.\n *\n * @param color The base color\n */\nexport const calculateContrastTwoColor = (color: CssColor) => {\n const contrastWhite = getContrastFromHex(color, '#ffffff');\n const contrastBlack = getContrastFromHex(color, '#000000');\n const lightness = getLightnessFromHex(color);\n const doubleALightnessModifier = lightness <= 40 ? 60 : lightness >= 60 ? 60 : 50;\n\n let targetLightness = 0;\n const contrastDirection = contrastWhite >= contrastBlack ? 'lighten' : 'darken';\n\n targetLightness =\n contrastDirection === 'lighten' ? lightness + doubleALightnessModifier : lightness - doubleALightnessModifier;\n\n return createColorWithLightness(color, targetLightness);\n};\n\n/**\n *\n * This function checks if white or black text can be used on 2 different colors at 4.5:1 contrast.\n *\n * @param baseDefaultColor Base default color\n * @param baseActiveColor Base active color\n */\nexport const canTextBeUsedOnColors = (baseDefaultColor: CssColor, baseActiveColor: CssColor) => {\n const defaultAgainstWhite = getContrastFromHex(baseDefaultColor, '#ffffff');\n const defaultAgainstBlack = getContrastFromHex(baseDefaultColor, '#000000');\n\n const activeAgainstWhite = getContrastFromHex(baseActiveColor, '#ffffff');\n const activeAgainstBlack = getContrastFromHex(baseActiveColor, '#000000');\n\n if (defaultAgainstWhite >= 4.5 && activeAgainstWhite >= 4.5) {\n return true;\n } else if (defaultAgainstBlack >= 4.5 && activeAgainstBlack >= 4.5) {\n return true;\n }\n\n return false;\n};\n\n/**\n *\n * This function creates a color with a specific lightness value.\n *\n * @param color The base color\n * @param lightness The lightness value from 0 to 100\n */\nexport const createColorWithLightness = (color: CssColor, lightness: number) => {\n const leoBackgroundColor = new BackgroundColor({\n name: 'backgroundColor',\n colorKeys: ['#ffffff'],\n ratios: [1],\n });\n const colors = new Color({\n name: 'color',\n colorKeys: [color],\n ratios: [getContrastFromLightness(lightness, color, '#ffffff')],\n });\n\n const theme = new Theme({\n colors: [colors],\n backgroundColor: leoBackgroundColor,\n lightness: 100,\n });\n return theme.contrastColorValues[0];\n};\n\n/**\n *\n * This function returns the color number based on the color name.\n *\n * @param name The name of the color\n */\nexport const getColorNumberFromName = (name: string): ColorNumber => {\n const colorMap: { [key: string]: ColorNumber } = {\n 'Background Subtle': 1,\n 'Background Default': 2,\n 'Surface Default': 3,\n 'Surface Hover': 4,\n 'Surface Active': 5,\n 'Border Subtle': 6,\n 'Border Default': 7,\n 'Border Strong': 8,\n 'Base Default': 9,\n 'Base Hover': 10,\n 'Base Active': 11,\n 'Text Subtle': 12,\n 'Text Default': 13,\n };\n return colorMap[name];\n};\n\n/**\n *\n * This function returns the color name based on the color number.\n *\n * @param number The number of the color\n */\nexport const getColorNameFromNumber = (number: ColorNumber): string => {\n const colorMap: { [key in ColorNumber]: string } = {\n 1: 'Background Subtle',\n 2: 'Background Default',\n 3: 'Surface Default',\n 4: 'Surface Hover',\n 5: 'Surface Active',\n 6: 'Border Subtle',\n 7: 'Border Default',\n 8: 'Border Strong',\n 9: 'Base Default',\n 10: 'Base Hover',\n 11: 'Base Active',\n 12: 'Text Subtle',\n 13: 'Text Default',\n 14: 'Contrast Default',\n 15: 'Contrast Subtle',\n };\n return colorMap[number];\n};\n\nexport const getBaseColor = (color: CssColor) => {\n const conv = new Hsluv();\n conv.hex = color;\n conv.hexToHsluv();\n // conv.hsluv_l = 100 - conv.hsluv_l;\n // conv.hsluv_s = getSaturationForDarkMode(color, conv.hsluv_s);\n conv.hsluvToHex();\n\n return conv.hex as CssColor;\n};\n\nexport const getCssVariable = (colorType: ColorType, colorNumber: ColorNumber) => {\n return `--ds-${colorType}-${getColorNameFromNumber(colorNumber).toLowerCase().replace(/\\s/g, '-')}`;\n};\n","import type { CssColor } from '@adobe/leonardo-contrast-colors';\nimport { Hsluv } from 'hsluv';\nimport chroma from 'chroma-js';\n\n/**\n * Converts a HEX color '#xxxxxx' into a CSS HSL string 'hsl(x,x,x)'\n *\n * @param hex A hex color string\n * @param valuesOnly If true, only the values are returned\n * @returns A CSS HSL string\n */\nexport const hexToCssHsl = (hex: string, valuesOnly = false) => {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n let r = 0;\n let g = 0;\n let b = 0;\n let cssString = '';\n if (result) {\n r = parseInt(result[1], 16);\n g = parseInt(result[2], 16);\n b = parseInt(result[3], 16);\n }\n (r /= 255), (g /= 255), (b /= 255);\n const max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n let h,\n s,\n l = (max + min) / 2;\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n }\n\n h = Math.round(h ? h * 360 : 0);\n s = Math.round(s * 100);\n l = Math.round(l * 100);\n\n cssString = h + ',' + s + '%,' + l + '%';\n cssString = !valuesOnly ? 'hsl(' + cssString + ')' : cssString;\n\n return cssString;\n};\n\n/**\n * Converts a HEX string '#xxxxxx' into an array of HSL values '[h,s,l]'\n *\n * @param H A Hex color string\n * @returns HSL values in an array\n */\nexport const hexToHSL = (H: string) => {\n // Convert hex to RGB first\n let r = 0,\n g = 0,\n b = 0;\n if (H.length == 4) {\n r = parseInt('0x' + H[1] + H[1]);\n g = parseInt('0x' + H[2] + H[2]);\n b = parseInt('0x' + H[3] + H[3]);\n } else if (H.length == 7) {\n r = parseInt('0x' + H[1] + H[2]);\n g = parseInt('0x' + H[3] + H[4]);\n b = parseInt('0x' + H[5] + H[6]);\n }\n // Then to HSL\n r /= 255;\n g /= 255;\n b /= 255;\n let h = 0,\n s = 0,\n l = 0;\n const cmin = Math.min(r, g, b),\n cmax = Math.max(r, g, b),\n delta = cmax - cmin;\n\n if (delta == 0) h = 0;\n else if (cmax == r) h = ((g - b) / delta) % 6;\n else if (cmax == g) h = (b - r) / delta + 2;\n else h = (r - g) / delta + 4;\n\n h = Math.round(h * 60);\n\n if (h < 0) h += 360;\n\n l = (cmax + cmin) / 2;\n s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));\n s = +(s * 100).toFixed(1);\n l = +(l * 100).toFixed(1);\n\n return [h, s, l];\n};\n\n/**\n * Converts a HSL number array '[h,s,l]' into HSL CSS string 'hsl(x,x,x)'\n *\n * @param HSL A HSL number array '[h,s,l]'\n * @returns A hex color string\n */\nexport const hslArrToCss = (HSL: number[]) => {\n return 'hsl(' + HSL[0] + ',' + HSL[1] + '%,' + HSL[2] + '%)';\n};\n\n/**\n * Converts a HSL CSS string 'hsl(x,x,x)' into an array of HSL values '[h,s,l]'\n *\n * @param h The HSL hue\n * @param s The HSL saturation\n * @param l The HSL lightness\n * @returns HEX color string\n */\nexport const HSLToHex = (h: number, s: number, l: number) => {\n s /= 100;\n l /= 100;\n\n let r = 0,\n g = 0,\n b = 0;\n const c = (1 - Math.abs(2 * l - 1)) * s,\n x = c * (1 - Math.abs(((h / 60) % 2) - 1)),\n m = l - c / 2;\n\n if (0 <= h && h < 60) {\n r = c;\n g = x;\n b = 0;\n } else if (60 <= h && h < 120) {\n r = x;\n g = c;\n b = 0;\n } else if (120 <= h && h < 180) {\n r = 0;\n g = c;\n b = x;\n } else if (180 <= h && h < 240) {\n r = 0;\n g = x;\n b = c;\n } else if (240 <= h && h < 300) {\n r = x;\n g = 0;\n b = c;\n } else if (300 <= h && h < 360) {\n r = c;\n g = 0;\n b = x;\n }\n // Having obtained RGB, convert channels to hex\n r = parseInt(Math.round((r + m) * 255).toString(16), 16);\n g = parseInt(Math.round((g + m) * 255).toString(16), 16);\n b = parseInt(Math.round((b + m) * 255).toString(16), 16);\n\n // Prepend 0s, if necessary\n if (r.toString().length == 1) r = parseInt('0' + r.toString(), 10);\n if (g.toString().length == 1) g = parseInt('0' + g.toString(), 10);\n if (b.toString().length == 1) b = parseInt('0' + b.toString(), 10);\n\n return '#' + r + g + b;\n};\n\n/**\n * Converts a HEX color '#xxxxxx' into an array of RGB values '[R, G, B]'\n *\n * @param hex A hex color string\n * @returns RGB values in an array\n */\nexport const hexToRgb = (hex: string) => {\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, function (m, r: string, g: string, b: string) {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : null;\n};\n\n/**\n * Get the luminance of an RGB color\n *\n * @param r RGB red value\n * @param G RGB green value\n * @param b RGB blue value\n * @returns\n */\nexport const luminanceFromRgb = (r: string, g: string, b: string) => {\n const a = [Number(r), Number(g), Number(b)].map(function (v) {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n};\n\n/**\n * Get the luminance of a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const luminanceFromHex = (hex: CssColor) => {\n const rgb = hexToRgb(hex);\n if (rgb) {\n const r = rgb.r.toString();\n const g = rgb.g.toString();\n const b = rgb.b.toString();\n return luminanceFromRgb(r, g, b);\n }\n return 2;\n};\n\n/**\n * Get the contrast ratio between two luminance values\n *\n * @param lum1 The first luminance value\n * @param lum2 The second luminance value\n * @returns\n */\nexport const getRatioFromLum = (lum1: number, lum2: number) => {\n if (lum1 !== null && lum2 !== null) {\n return (Math.max(lum1, lum2) + 0.05) / (Math.min(lum1, lum2) + 0.05);\n } else {\n return -1;\n }\n};\n\n/**\n * Get the HSL lightness from a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const getHslLightessFromHex = (hex: CssColor) => {\n return chroma(hex).hsl()[2];\n};\n\nexport const getHslSaturationFromHex = (hex: CssColor) => {\n return chroma(hex).hsl()[1];\n};\n\n/**\n * Get the HSLuv lightness from a HEX color\n *\n * @param hex A hex color string\n * @returns\n */\nexport const getLightnessFromHex = (hex: string) => {\n const conv = new Hsluv();\n conv.hex = hex;\n conv.hexToHsluv();\n return Number(conv.hsluv_l.toFixed(0));\n};\n\n/**\n * Get the contrast ratio between two HEX colors\n *\n * @param {CssColor} color1 The first color\n * @param {CssColor} color2 The second color\n * @returns\n */\nexport const getContrastFromHex = (color1: CssColor, color2: CssColor) => {\n const lum1 = luminanceFromHex(color1);\n const lum2 = luminanceFromHex(color2);\n if (lum1 !== null && lum2 !== null) {\n return getRatioFromLum(lum1, lum2);\n }\n return -1;\n};\n\n/**\n * Get the contrast ratio between two colors at a specific lightness\n *\n * @param lightness The lightness value\n * @param mainColor The main color\n * @param backgroundColor The background color\n * @returns The contrast ratio\n */\nexport const getContrastFromLightness = (lightness: number, mainColor: CssColor, backgroundColor: CssColor) => {\n const conv = new Hsluv();\n conv.hex = mainColor;\n conv.hexToHsluv();\n conv.hsluv_l = lightness;\n conv.hsluvToHex();\n const lightMainColor = conv.hex;\n const lum1 = luminanceFromHex(lightMainColor as CssColor);\n const lum2 = luminanceFromHex(backgroundColor);\n const ratio = getRatioFromLum(lum1 ?? 0, lum2 ?? 0);\n\n return ratio;\n};\n\n/**\n * Maps the numbers from [start1 - end1] to the range [start2 - end2], maintaining the proportionality between the numbers in the ranges using lineaer interpolation.\n */\n// const mapRange = (value: number, start1: number, end1: number, start2: number, end2: number) => {\n// return start2 + ((value - start1) * (end2 - start2)) / (end1 - start1);\n// };\n\n/**\n * Check if two colors have enough contrast to be used together\n *\n * @param {CssColor} color1 The first color\n * @param {CssColor} color2 The second color\n * @returns {boolean} If the colors have enough contrast\n */\nexport const areColorsContrasting = (color1: CssColor, color2: CssColor, type: 'text' | 'decorative' = 'text') => {\n const contrast = getContrastFromHex(color1, color2);\n if (contrast !== null) {\n if (type === 'text') {\n return contrast >= 4.5;\n } else {\n return contrast >= 3;\n }\n }\n return false;\n};\n\n/**\n * Check if aa string value is a HEX color\n *\n * @param {string} hex The string to check\n * @returns {boolean} If the string is a HEX color\n */\nexport const isHexColor = (hex: string) => {\n return typeof hex === 'string' && hex.length === 6 && !isNaN(Number('0x' + hex));\n};\n"],"mappings":";AACA,SAAS,iBAAiB,OAAO,aAAa;AAC9C,SAAS,SAAAA,cAAa;;;ACDtB,SAAS,aAAa;AACtB,OAAO,YAAY;AA+KZ,IAAM,WAAW,CAAC,QAAgB;AACvC,QAAM,iBAAiB;AACvB,QAAM,IAAI,QAAQ,gBAAgB,SAAU,GAAG,GAAW,GAAW,GAAW;AAC9E,WAAO,IAAI,IAAI,IAAI,IAAI,IAAI;AAAA,EAC7B,CAAC;AAED,QAAM,SAAS,4CAA4C,KAAK,GAAG;AACnE,SAAO,SACH;AAAA,IACE,GAAG,SAAS,OAAO,CAAC,GAAG,EAAE;AAAA,IACzB,GAAG,SAAS,OAAO,CAAC,GAAG,EAAE;AAAA,IACzB,GAAG,SAAS,OAAO,CAAC,GAAG,EAAE;AAAA,EAC3B,IACA;AACN;AAUO,IAAM,mBAAmB,CAAC,GAAW,GAAW,MAAc;AACnE,QAAM,IAAI,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,IAAI,SAAU,GAAG;AAC3D,SAAK;AACL,WAAO,KAAK,UAAU,IAAI,QAAQ,KAAK,KAAK,IAAI,SAAS,OAAO,GAAG;AAAA,EACrE,CAAC;AACD,SAAO,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,IAAI;AAChD;AAQO,IAAM,mBAAmB,CAAC,QAAkB;AACjD,QAAM,MAAM,SAAS,GAAG;AACxB,MAAI,KAAK;AACP,UAAM,IAAI,IAAI,EAAE,SAAS;AACzB,UAAM,IAAI,IAAI,EAAE,SAAS;AACzB,UAAM,IAAI,IAAI,EAAE,SAAS;AACzB,WAAO,iBAAiB,GAAG,GAAG,CAAC;AAAA,EACjC;AACA,SAAO;AACT;AASO,IAAM,kBAAkB,CAAC,MA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AA,IACnB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,eAAe;AAAA,IACf,gBAAgB;AAAA,EAClB;AACA,SAAO,SAAS,IAAI;AACtB;AAQO,IAAM,yBAAyB,CAAC,WAAgC;AACrE,QAAM,WAA6C;AAAA,IACjD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AACA,SAAO,SAAS,MAAM;AACxB;AAEO,IAAM,eAAe,CAAC,UAAoB;AAC/C,QAAM,OAAO,IAAIE,OAAM;AACvB,OAAK,MAAM;AACX,OAAK,WAAW;AAGhB,OAAK,WAAW;AAEhB,SAAO,KAAK;AACd;AAEO,IAAM,iBAAiB,CAAC,WAAsB,gBAA6B;AAChF,SAAO,QAAQ,SAAS,IAAI,uBAAuB,WAAW,EAAE,YAAY,EAAE,QAAQ,OAAO,GAAG,CAAC;AACnG;","names":["Hsluv","color","lightnessScale","Hsluv"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}