@lakuna/color 1.1.2 → 1.2.0
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.
- package/LICENSE +1 -1
- package/dist/{utility → convert}/adobeToXyz.d.ts +1 -1
- package/dist/convert/adobeToXyz.d.ts.map +1 -0
- package/dist/{utility → convert}/adobeToXyz.js +5 -3
- package/dist/convert/adobeToXyz.js.map +1 -0
- package/dist/{utility → convert}/cmyToCmyk.d.ts +1 -1
- package/dist/convert/cmyToCmyk.d.ts.map +1 -0
- package/dist/{utility → convert}/cmyToCmyk.js +0 -3
- package/dist/convert/cmyToCmyk.js.map +1 -0
- package/dist/{utility → convert}/cmyToRgb.d.ts +1 -1
- package/dist/{utility → convert}/cmyToRgb.d.ts.map +1 -1
- package/dist/{utility → convert}/cmyToRgb.js.map +1 -1
- package/dist/{utility → convert}/cmykToCmy.d.ts +1 -1
- package/dist/{utility → convert}/cmykToCmy.d.ts.map +1 -1
- package/dist/{utility → convert}/cmykToCmy.js +0 -1
- package/dist/convert/cmykToCmy.js.map +1 -0
- package/dist/{utility → convert}/hexToRgb.d.ts +1 -1
- package/dist/convert/hexToRgb.d.ts.map +1 -0
- package/dist/{utility → convert}/hexToRgb.js.map +1 -1
- package/dist/{utility → convert}/hslToRgb.d.ts +1 -1
- package/dist/convert/hslToRgb.d.ts.map +1 -0
- package/dist/{utility → convert}/hslToRgb.js +5 -6
- package/dist/convert/hslToRgb.js.map +1 -0
- package/dist/{utility → convert}/hsvToRgb.d.ts +1 -1
- package/dist/{utility → convert}/hsvToRgb.d.ts.map +1 -1
- package/dist/{utility → convert}/hsvToRgb.js +0 -2
- package/dist/convert/hsvToRgb.js.map +1 -0
- package/dist/{utility → convert}/hunterToXyz.d.ts +1 -1
- package/dist/convert/hunterToXyz.d.ts.map +1 -0
- package/dist/{utility → convert}/hunterToXyz.js +6 -7
- package/dist/convert/hunterToXyz.js.map +1 -0
- package/dist/convert/labToLch.d.ts +19 -0
- package/dist/convert/labToLch.d.ts.map +1 -0
- package/dist/convert/labToLch.js +12 -0
- package/dist/convert/labToLch.js.map +1 -0
- package/dist/{utility → convert}/labToXyz.d.ts +1 -1
- package/dist/convert/labToXyz.d.ts.map +1 -0
- package/dist/{utility → convert}/labToXyz.js +8 -5
- package/dist/convert/labToXyz.js.map +1 -0
- package/dist/convert/lchToLab.d.ts +19 -0
- package/dist/convert/lchToLab.d.ts.map +1 -0
- package/dist/convert/lchToLab.js +7 -0
- package/dist/convert/lchToLab.js.map +1 -0
- package/dist/{utility → convert}/luvToXyz.d.ts +1 -1
- package/dist/convert/luvToXyz.d.ts.map +1 -0
- package/dist/{utility → convert}/luvToXyz.js +4 -6
- package/dist/convert/luvToXyz.js.map +1 -0
- package/dist/{utility → convert}/rgbToCmy.d.ts +1 -1
- package/dist/{utility → convert}/rgbToCmy.d.ts.map +1 -1
- package/dist/{utility → convert}/rgbToCmy.js.map +1 -1
- package/dist/{utility → convert}/rgbToHex.d.ts.map +1 -1
- package/dist/{utility → convert}/rgbToHex.js +3 -1
- package/dist/convert/rgbToHex.js.map +1 -0
- package/dist/convert/rgbToHsi.d.ts +10 -0
- package/dist/convert/rgbToHsi.d.ts.map +1 -0
- package/dist/convert/rgbToHsi.js +36 -0
- package/dist/convert/rgbToHsi.js.map +1 -0
- package/dist/{utility → convert}/rgbToHsl.d.ts +1 -1
- package/dist/convert/rgbToHsl.d.ts.map +1 -0
- package/dist/convert/rgbToHsl.js +37 -0
- package/dist/convert/rgbToHsl.js.map +1 -0
- package/dist/{utility → convert}/rgbToHsv.d.ts +1 -1
- package/dist/convert/rgbToHsv.d.ts.map +1 -0
- package/dist/{utility → convert}/rgbToHsv.js +11 -11
- package/dist/convert/rgbToHsv.js.map +1 -0
- package/dist/{utility → convert}/rgbToXyz.d.ts +1 -1
- package/dist/convert/rgbToXyz.d.ts.map +1 -0
- package/dist/{utility → convert}/rgbToXyz.js +9 -3
- package/dist/convert/rgbToXyz.js.map +1 -0
- package/dist/{utility → convert}/xyzToAdobe.d.ts +1 -1
- package/dist/convert/xyzToAdobe.d.ts.map +1 -0
- package/dist/{utility → convert}/xyzToAdobe.js +5 -3
- package/dist/convert/xyzToAdobe.js.map +1 -0
- package/dist/{utility → convert}/xyzToHunter.d.ts +2 -2
- package/dist/convert/xyzToHunter.d.ts.map +1 -0
- package/dist/{utility → convert}/xyzToHunter.js +7 -8
- package/dist/convert/xyzToHunter.js.map +1 -0
- package/dist/{utility → convert}/xyzToLab.d.ts +1 -1
- package/dist/convert/xyzToLab.d.ts.map +1 -0
- package/dist/{utility → convert}/xyzToLab.js +9 -5
- package/dist/convert/xyzToLab.js.map +1 -0
- package/dist/{utility → convert}/xyzToLuv.d.ts +1 -1
- package/dist/convert/xyzToLuv.d.ts.map +1 -0
- package/dist/{utility → convert}/xyzToLuv.js +5 -7
- package/dist/convert/xyzToLuv.js.map +1 -0
- package/dist/{utility → convert}/xyzToRgb.d.ts +1 -1
- package/dist/convert/xyzToRgb.d.ts.map +1 -0
- package/dist/{utility → convert}/xyzToRgb.js +8 -3
- package/dist/convert/xyzToRgb.js.map +1 -0
- package/dist/{utility → convert}/xyzToYxy.d.ts +1 -1
- package/dist/{utility → convert}/xyzToYxy.d.ts.map +1 -1
- package/dist/{utility → convert}/xyzToYxy.js +0 -3
- package/dist/convert/xyzToYxy.js.map +1 -0
- package/dist/{utility → convert}/yxyToXyz.d.ts +1 -1
- package/dist/{utility → convert}/yxyToXyz.d.ts.map +1 -1
- package/dist/{utility → convert}/yxyToXyz.js +0 -3
- package/dist/convert/yxyToXyz.js.map +1 -0
- package/dist/delta/deltaC.d.ts.map +1 -0
- package/dist/delta/deltaC.js.map +1 -0
- package/dist/{utility → delta}/deltaCmc.d.ts +2 -2
- package/dist/delta/deltaCmc.d.ts.map +1 -0
- package/dist/{utility → delta}/deltaCmc.js +5 -8
- package/dist/delta/deltaCmc.js.map +1 -0
- package/dist/{utility → delta}/deltaE00.d.ts +2 -2
- package/dist/delta/deltaE00.d.ts.map +1 -0
- package/dist/{utility → delta}/deltaE00.js +13 -17
- package/dist/delta/deltaE00.js.map +1 -0
- package/dist/delta/deltaE76.d.ts.map +1 -0
- package/dist/delta/deltaE76.js.map +1 -0
- package/dist/{utility → delta}/deltaE94.d.ts +2 -2
- package/dist/delta/deltaE94.d.ts.map +1 -0
- package/dist/{utility → delta}/deltaE94.js +0 -6
- package/dist/delta/deltaE94.js.map +1 -0
- package/dist/delta/deltaH.d.ts.map +1 -0
- package/dist/{utility → delta}/deltaH.js +0 -4
- package/dist/delta/deltaH.js.map +1 -0
- package/dist/index.d.ts +41 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -30
- package/dist/index.js.map +1 -1
- package/dist/names/bang.d.ts +2 -2
- package/dist/names/bang.d.ts.map +1 -1
- package/dist/names/bang.js +471 -471
- package/dist/names/bang.js.map +1 -1
- package/dist/names/cne.d.ts +1 -1
- package/dist/names/cne.d.ts.map +1 -1
- package/dist/names/cne.js +843 -843
- package/dist/names/cne.js.map +1 -1
- package/dist/names/crayola.d.ts +1 -1
- package/dist/names/crayola.d.ts.map +1 -1
- package/dist/names/crayola.js +110 -110
- package/dist/names/crayola.js.map +1 -1
- package/dist/names/getName.d.ts.map +1 -1
- package/dist/names/getName.js +3 -3
- package/dist/names/getName.js.map +1 -1
- package/dist/names/hollasch.d.ts +1 -1
- package/dist/names/hollasch.d.ts.map +1 -1
- package/dist/names/hollasch.js +179 -179
- package/dist/names/hollasch.js.map +1 -1
- package/dist/names/nbs.d.ts +1 -1
- package/dist/names/nbs.d.ts.map +1 -1
- package/dist/names/nbs.js +266 -266
- package/dist/names/nbs.js.map +1 -1
- package/dist/names/ntc.d.ts +1 -1
- package/dist/names/ntc.d.ts.map +1 -1
- package/dist/names/ntc.js +1519 -1519
- package/dist/names/ntc.js.map +1 -1
- package/dist/names/resene.d.ts +1 -1
- package/dist/names/resene.d.ts.map +1 -1
- package/dist/names/resene.js +1331 -1331
- package/dist/names/resene.js.map +1 -1
- package/dist/names/tcapi.d.ts +1 -1
- package/dist/names/tcapi.d.ts.map +1 -1
- package/dist/names/tcapi.js +1840 -1840
- package/dist/names/tcapi.js.map +1 -1
- package/dist/names/x11.d.ts +1 -1
- package/dist/names/x11.d.ts.map +1 -1
- package/dist/names/x11.js +445 -445
- package/dist/names/x11.js.map +1 -1
- package/dist/names/xkcd.d.ts +1 -1
- package/dist/names/xkcd.d.ts.map +1 -1
- package/dist/names/xkcd.js +897 -897
- package/dist/names/xkcd.js.map +1 -1
- package/dist/palette/analogous.d.ts +28 -0
- package/dist/palette/analogous.d.ts.map +1 -0
- package/dist/palette/analogous.js +15 -0
- package/dist/palette/analogous.js.map +1 -0
- package/dist/palette/analogousLch.d.ts +19 -0
- package/dist/palette/analogousLch.d.ts.map +1 -0
- package/dist/palette/analogousLch.js +15 -0
- package/dist/palette/analogousLch.js.map +1 -0
- package/dist/palette/complement.d.ts +28 -0
- package/dist/palette/complement.d.ts.map +1 -0
- package/dist/palette/complement.js +15 -0
- package/dist/palette/complement.js.map +1 -0
- package/dist/palette/complementLch.d.ts +19 -0
- package/dist/palette/complementLch.d.ts.map +1 -0
- package/dist/palette/complementLch.js +15 -0
- package/dist/palette/complementLch.js.map +1 -0
- package/dist/palette/splitComplement.d.ts +28 -0
- package/dist/palette/splitComplement.d.ts.map +1 -0
- package/dist/palette/splitComplement.js +15 -0
- package/dist/palette/splitComplement.js.map +1 -0
- package/dist/palette/splitComplementLch.d.ts +19 -0
- package/dist/palette/splitComplementLch.d.ts.map +1 -0
- package/dist/palette/splitComplementLch.js +15 -0
- package/dist/palette/splitComplementLch.js.map +1 -0
- package/dist/types/Adobe.d.ts.map +1 -1
- package/dist/types/Cmy.d.ts.map +1 -1
- package/dist/types/Cmyk.d.ts.map +1 -1
- package/dist/types/Hsi.d.ts +15 -0
- package/dist/types/Hsi.d.ts.map +1 -0
- package/dist/types/Hsi.js +2 -0
- package/dist/types/Hsi.js.map +1 -0
- package/dist/types/Hsl.d.ts +1 -1
- package/dist/types/Hsl.d.ts.map +1 -1
- package/dist/types/Hsv.d.ts +1 -1
- package/dist/types/Hsv.d.ts.map +1 -1
- package/dist/types/Hunter.d.ts.map +1 -1
- package/dist/types/Lab.d.ts +2 -2
- package/dist/types/Lab.d.ts.map +1 -1
- package/dist/types/Lchab.d.ts +15 -0
- package/dist/types/Lchab.d.ts.map +1 -0
- package/dist/types/Lchab.js +2 -0
- package/dist/types/Lchab.js.map +1 -0
- package/dist/types/Lchuv.d.ts +15 -0
- package/dist/types/Lchuv.d.ts.map +1 -0
- package/dist/types/Lchuv.js +2 -0
- package/dist/types/Lchuv.js.map +1 -0
- package/dist/types/Luv.d.ts +1 -1
- package/dist/types/Luv.d.ts.map +1 -1
- package/dist/types/Rgb.d.ts.map +1 -1
- package/dist/types/Xyz.d.ts.map +1 -1
- package/dist/types/Yxy.d.ts.map +1 -1
- package/dist/utility/StandardIlluminant.d.ts.map +1 -1
- package/dist/utility/StandardIlluminant.js.map +1 -1
- package/dist/utility/contrast.d.ts.map +1 -1
- package/dist/utility/contrast.js.map +1 -1
- package/dist/utility/getReference.d.ts +2 -2
- package/dist/utility/getReference.d.ts.map +1 -1
- package/dist/utility/getReference.js +39 -39
- package/dist/utility/getReference.js.map +1 -1
- package/dist/utility/isWebSafe.d.ts +10 -0
- package/dist/utility/isWebSafe.d.ts.map +1 -0
- package/dist/utility/isWebSafe.js +11 -0
- package/dist/utility/isWebSafe.js.map +1 -0
- package/dist/utility/relativeLuminance.js.map +1 -1
- package/package.json +15 -15
- package/src/{utility → convert}/adobeToXyz.ts +10 -4
- package/src/{utility → convert}/cmyToCmyk.ts +5 -4
- package/src/{utility → convert}/cmyToRgb.ts +1 -1
- package/src/{utility → convert}/cmykToCmy.ts +1 -2
- package/src/{utility → convert}/hexToRgb.ts +1 -1
- package/src/{utility → convert}/hslToRgb.ts +9 -7
- package/src/{utility → convert}/hsvToRgb.ts +2 -3
- package/src/{utility → convert}/hunterToXyz.ts +11 -8
- package/src/convert/labToLch.ts +36 -0
- package/src/{utility → convert}/labToXyz.ts +11 -6
- package/src/convert/lchToLab.ts +30 -0
- package/src/{utility → convert}/luvToXyz.ts +9 -7
- package/src/{utility → convert}/rgbToCmy.ts +1 -1
- package/src/{utility → convert}/rgbToHex.ts +5 -1
- package/src/convert/rgbToHsi.ts +43 -0
- package/src/convert/rgbToHsl.ts +44 -0
- package/src/{utility → convert}/rgbToHsv.ts +14 -13
- package/src/{utility → convert}/rgbToXyz.ts +11 -4
- package/src/{utility → convert}/xyzToAdobe.ts +9 -4
- package/src/{utility → convert}/xyzToHunter.ts +12 -9
- package/src/{utility → convert}/xyzToLab.ts +12 -6
- package/src/{utility → convert}/xyzToLuv.ts +11 -9
- package/src/{utility → convert}/xyzToRgb.ts +10 -4
- package/src/{utility → convert}/xyzToYxy.ts +3 -4
- package/src/{utility → convert}/yxyToXyz.ts +3 -4
- package/src/{utility → delta}/deltaC.ts +0 -2
- package/src/{utility → delta}/deltaCmc.ts +12 -10
- package/src/{utility → delta}/deltaE00.ts +21 -18
- package/src/{utility → delta}/deltaE76.ts +0 -2
- package/src/{utility → delta}/deltaE94.ts +7 -8
- package/src/{utility → delta}/deltaH.ts +3 -6
- package/src/index.ts +47 -31
- package/src/names/bang.ts +476 -472
- package/src/names/cne.ts +848 -844
- package/src/names/crayola.ts +115 -111
- package/src/names/getName.ts +4 -3
- package/src/names/hollasch.ts +184 -180
- package/src/names/nbs.ts +271 -267
- package/src/names/ntc.ts +1524 -1520
- package/src/names/resene.ts +1336 -1332
- package/src/names/tcapi.ts +1845 -1841
- package/src/names/x11.ts +450 -446
- package/src/names/xkcd.ts +902 -898
- package/src/palette/analogous.ts +61 -0
- package/src/palette/analogousLch.ts +49 -0
- package/src/palette/complement.ts +65 -0
- package/src/palette/complementLch.ts +50 -0
- package/src/palette/splitComplement.ts +61 -0
- package/src/palette/splitComplementLch.ts +48 -0
- package/src/types/Adobe.ts +3 -0
- package/src/types/Cmy.ts +3 -0
- package/src/types/Cmyk.ts +4 -0
- package/src/types/Hsi.ts +20 -0
- package/src/types/Hsl.ts +4 -1
- package/src/types/Hsv.ts +4 -1
- package/src/types/Hunter.ts +3 -0
- package/src/types/Lab.ts +5 -2
- package/src/types/Lchab.ts +20 -0
- package/src/types/Lchuv.ts +20 -0
- package/src/types/Luv.ts +4 -1
- package/src/types/Rgb.ts +3 -0
- package/src/types/Xyz.ts +3 -0
- package/src/types/Yxy.ts +3 -0
- package/src/utility/StandardIlluminant.ts +40 -40
- package/src/utility/contrast.ts +1 -0
- package/src/utility/getReference.ts +42 -41
- package/src/utility/isWebSafe.ts +14 -0
- package/src/utility/relativeLuminance.ts +1 -1
- package/dist/types/Lch.d.ts +0 -16
- package/dist/types/Lch.d.ts.map +0 -1
- package/dist/types/Lch.js +0 -2
- package/dist/types/Lch.js.map +0 -1
- package/dist/utility/adobeToXyz.d.ts.map +0 -1
- package/dist/utility/adobeToXyz.js.map +0 -1
- package/dist/utility/cmyToCmyk.d.ts.map +0 -1
- package/dist/utility/cmyToCmyk.js.map +0 -1
- package/dist/utility/cmykToCmy.js.map +0 -1
- package/dist/utility/deltaC.d.ts.map +0 -1
- package/dist/utility/deltaC.js.map +0 -1
- package/dist/utility/deltaCmc.d.ts.map +0 -1
- package/dist/utility/deltaCmc.js.map +0 -1
- package/dist/utility/deltaE00.d.ts.map +0 -1
- package/dist/utility/deltaE00.js.map +0 -1
- package/dist/utility/deltaE76.d.ts.map +0 -1
- package/dist/utility/deltaE76.js.map +0 -1
- package/dist/utility/deltaE94.d.ts.map +0 -1
- package/dist/utility/deltaE94.js.map +0 -1
- package/dist/utility/deltaH.d.ts.map +0 -1
- package/dist/utility/deltaH.js.map +0 -1
- package/dist/utility/hexToRgb.d.ts.map +0 -1
- package/dist/utility/hslToRgb.d.ts.map +0 -1
- package/dist/utility/hslToRgb.js.map +0 -1
- package/dist/utility/hsvToRgb.js.map +0 -1
- package/dist/utility/hunterToXyz.d.ts.map +0 -1
- package/dist/utility/hunterToXyz.js.map +0 -1
- package/dist/utility/labToLch.d.ts +0 -11
- package/dist/utility/labToLch.d.ts.map +0 -1
- package/dist/utility/labToLch.js +0 -19
- package/dist/utility/labToLch.js.map +0 -1
- package/dist/utility/labToXyz.d.ts.map +0 -1
- package/dist/utility/labToXyz.js.map +0 -1
- package/dist/utility/lchToLab.d.ts +0 -11
- package/dist/utility/lchToLab.d.ts.map +0 -1
- package/dist/utility/lchToLab.js +0 -14
- package/dist/utility/lchToLab.js.map +0 -1
- package/dist/utility/luvToXyz.d.ts.map +0 -1
- package/dist/utility/luvToXyz.js.map +0 -1
- package/dist/utility/rgbToHex.js.map +0 -1
- package/dist/utility/rgbToHsl.d.ts.map +0 -1
- package/dist/utility/rgbToHsl.js +0 -31
- package/dist/utility/rgbToHsl.js.map +0 -1
- package/dist/utility/rgbToHsv.d.ts.map +0 -1
- package/dist/utility/rgbToHsv.js.map +0 -1
- package/dist/utility/rgbToXyz.d.ts.map +0 -1
- package/dist/utility/rgbToXyz.js.map +0 -1
- package/dist/utility/xyzToAdobe.d.ts.map +0 -1
- package/dist/utility/xyzToAdobe.js.map +0 -1
- package/dist/utility/xyzToHunter.d.ts.map +0 -1
- package/dist/utility/xyzToHunter.js.map +0 -1
- package/dist/utility/xyzToLab.d.ts.map +0 -1
- package/dist/utility/xyzToLab.js.map +0 -1
- package/dist/utility/xyzToLuv.d.ts.map +0 -1
- package/dist/utility/xyzToLuv.js.map +0 -1
- package/dist/utility/xyzToRgb.d.ts.map +0 -1
- package/dist/utility/xyzToRgb.js.map +0 -1
- package/dist/utility/xyzToYxy.js.map +0 -1
- package/dist/utility/yxyToXyz.js.map +0 -1
- package/src/types/Lch.ts +0 -18
- package/src/utility/labToLch.ts +0 -24
- package/src/utility/lchToLab.ts +0 -18
- package/src/utility/rgbToHsl.ts +0 -38
- /package/dist/{utility → convert}/cmyToRgb.js +0 -0
- /package/dist/{utility → convert}/hexToRgb.js +0 -0
- /package/dist/{utility → convert}/rgbToCmy.js +0 -0
- /package/dist/{utility → convert}/rgbToHex.d.ts +0 -0
- /package/dist/{utility → delta}/deltaC.d.ts +0 -0
- /package/dist/{utility → delta}/deltaC.js +0 -0
- /package/dist/{utility → delta}/deltaE76.d.ts +0 -0
- /package/dist/{utility → delta}/deltaE76.js +0 -0
- /package/dist/{utility → delta}/deltaH.d.ts +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type Hsi from "../types/Hsi.js";
|
|
2
|
+
import type Hsl from "../types/Hsl.js";
|
|
3
|
+
import type Hsv from "../types/Hsv.js";
|
|
4
|
+
|
|
5
|
+
/** Number of degrees in a circle. */
|
|
6
|
+
const d = 360;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Determine the analogous colors of the given color.
|
|
10
|
+
* @param color - The color to find the analogues of in HSI.
|
|
11
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
12
|
+
* @returns The analogues of the given color.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export default function analogous(
|
|
16
|
+
color: Hsi,
|
|
17
|
+
subdivisions?: number
|
|
18
|
+
): [[number, number, number] & Hsi, [number, number, number] & Hsi];
|
|
19
|
+
/**
|
|
20
|
+
* Determine the analogous colors of the given color.
|
|
21
|
+
* @param color - The color to find the analogues of in HSL.
|
|
22
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
23
|
+
* @returns The analogues of the given color.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export default function analogous(
|
|
27
|
+
color: Hsl,
|
|
28
|
+
subdivisions?: number
|
|
29
|
+
): [[number, number, number] & Hsl, [number, number, number] & Hsl];
|
|
30
|
+
/**
|
|
31
|
+
* Determine the analogous colors of the given color.
|
|
32
|
+
* @param color - The color to find the analogues of in HSV.
|
|
33
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
34
|
+
* @returns The analogues of the given color.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export default function analogous(
|
|
38
|
+
color: Hsv,
|
|
39
|
+
subdivisions?: number
|
|
40
|
+
): [[number, number, number] & Hsv, [number, number, number] & Hsv];
|
|
41
|
+
export default function analogous(
|
|
42
|
+
color: Hsi | Hsl | Hsv,
|
|
43
|
+
subdivisions = 12
|
|
44
|
+
):
|
|
45
|
+
| [[number, number, number] & Hsi, [number, number, number] & Hsi]
|
|
46
|
+
| [[number, number, number] & Hsl, [number, number, number] & Hsl]
|
|
47
|
+
| [[number, number, number] & Hsv, [number, number, number] & Hsv] {
|
|
48
|
+
const s = color[1];
|
|
49
|
+
|
|
50
|
+
const x = color[2];
|
|
51
|
+
|
|
52
|
+
const hueAngle = color[0] * d;
|
|
53
|
+
const deltaAngle = d / subdivisions;
|
|
54
|
+
const underAngle = hueAngle - deltaAngle;
|
|
55
|
+
const overAngle = hueAngle + deltaAngle;
|
|
56
|
+
|
|
57
|
+
return [
|
|
58
|
+
[(underAngle > d ? underAngle - d : underAngle) / d, s, x],
|
|
59
|
+
[(overAngle > d ? overAngle - d : overAngle) / d, s, x]
|
|
60
|
+
];
|
|
61
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type Lchab from "../types/Lchab.js";
|
|
2
|
+
import type Lchuv from "../types/Lchuv.js";
|
|
3
|
+
|
|
4
|
+
/** Number of degrees in a circle. */
|
|
5
|
+
const d = 360;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Determine the analogous colors of the given color.
|
|
9
|
+
* @param color - The color to find the analogues of in CIE-L\*Ch(ab).
|
|
10
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
11
|
+
* @returns The analogues of the given color.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export default function analogousLch(
|
|
15
|
+
color: Lchab,
|
|
16
|
+
subdivisions?: number
|
|
17
|
+
): [[number, number, number] & Lchab, [number, number, number] & Lchab];
|
|
18
|
+
/**
|
|
19
|
+
* Determine the analogous colors of the given color.
|
|
20
|
+
* @param color - The color to find the analogues of in CIE-L\*Ch(uv).
|
|
21
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
22
|
+
* @returns The analogues of the given color.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export default function analogousLch(
|
|
26
|
+
color: Lchuv,
|
|
27
|
+
subdivisions?: number
|
|
28
|
+
): [[number, number, number] & Lchuv, [number, number, number] & Lchuv];
|
|
29
|
+
export default function analogousLch(
|
|
30
|
+
color: Lchab | Lchuv,
|
|
31
|
+
subdivisions = 12
|
|
32
|
+
):
|
|
33
|
+
| [[number, number, number] & Lchab, [number, number, number] & Lchab]
|
|
34
|
+
| [[number, number, number] & Lchuv, [number, number, number] & Lchuv] {
|
|
35
|
+
const l = color[0];
|
|
36
|
+
|
|
37
|
+
const c = color[1];
|
|
38
|
+
|
|
39
|
+
const h = color[2];
|
|
40
|
+
|
|
41
|
+
const deltaAngle = d / subdivisions;
|
|
42
|
+
const underAngle = h - deltaAngle;
|
|
43
|
+
const overAngle = h + deltaAngle;
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
[l, c, (underAngle > d ? underAngle - d : underAngle) / d],
|
|
47
|
+
[l, c, (overAngle > d ? overAngle - d : overAngle) / d]
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type Hsi from "../types/Hsi.js";
|
|
2
|
+
import type Hsl from "../types/Hsl.js";
|
|
3
|
+
import type Hsv from "../types/Hsv.js";
|
|
4
|
+
|
|
5
|
+
/** Number of degrees in a circle. */
|
|
6
|
+
const d = 360;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Determine the complementary color(s) of the given color.
|
|
10
|
+
* @param color - The color to find the complement(s) of in HSI.
|
|
11
|
+
* @param n - The number of complements to find. This can be `1` for a complementary color, `2` for triadic colors, `3` for tetradic colors, and so on.
|
|
12
|
+
* @returns The complements of the given color.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export default function complement(
|
|
16
|
+
color: Hsi,
|
|
17
|
+
n?: number
|
|
18
|
+
): ([number, number, number] & Hsi)[];
|
|
19
|
+
/**
|
|
20
|
+
* Determine the complementary color(s) of the given color.
|
|
21
|
+
* @param color - The color to find the complement(s) of in HSL.
|
|
22
|
+
* @param n - The number of complements to find. This can be `1` for a complementary color, `2` for triadic colors, `3` for tetradic colors, and so on.
|
|
23
|
+
* @returns The complements of the given color.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export default function complement(
|
|
27
|
+
color: Hsl,
|
|
28
|
+
n?: number
|
|
29
|
+
): ([number, number, number] & Hsl)[];
|
|
30
|
+
/**
|
|
31
|
+
* Determine the complementary color(s) of the given color.
|
|
32
|
+
* @param color - The color to find the complement(s) of in HSV.
|
|
33
|
+
* @param n - The number of complements to find. This can be `1` for a complementary color, `2` for triadic colors, `3` for tetradic colors, and so on.
|
|
34
|
+
* @returns The complements of the given color.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export default function complement(
|
|
38
|
+
color: Hsv,
|
|
39
|
+
n?: number
|
|
40
|
+
): ([number, number, number] & Hsv)[];
|
|
41
|
+
export default function complement(
|
|
42
|
+
color: Hsi | Hsl | Hsv,
|
|
43
|
+
n = 1
|
|
44
|
+
):
|
|
45
|
+
| ([number, number, number] & Hsi)[]
|
|
46
|
+
| ([number, number, number] & Hsl)[]
|
|
47
|
+
| ([number, number, number] & Hsv)[] {
|
|
48
|
+
const s = color[1];
|
|
49
|
+
|
|
50
|
+
const x = color[2];
|
|
51
|
+
|
|
52
|
+
const hueAngle = color[0] * d;
|
|
53
|
+
const deltaAngle = d / (n + 1);
|
|
54
|
+
|
|
55
|
+
const out:
|
|
56
|
+
| ([number, number, number] & Hsi)[]
|
|
57
|
+
| ([number, number, number] & Hsl)[]
|
|
58
|
+
| ([number, number, number] & Hsv)[] = [];
|
|
59
|
+
for (let i = 1; i <= n; i++) {
|
|
60
|
+
const angle = hueAngle + deltaAngle * i;
|
|
61
|
+
out.push([(angle > d ? angle - d : angle) / d, s, x]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type Lchab from "../types/Lchab.js";
|
|
2
|
+
import type Lchuv from "../types/Lchuv.js";
|
|
3
|
+
|
|
4
|
+
/** Number of degrees in a circle. */
|
|
5
|
+
const d = 360;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Determine the complementary color(s) of the given color.
|
|
9
|
+
* @param color - The color to find the complement(s) of in CIE-L\*Ch(ab).
|
|
10
|
+
* @param n - The number of complements to find. This can be `1` for a complementary color, `2` for triadic colors, `3` for tetradic colors, and so on.
|
|
11
|
+
* @returns The complements of the given color.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export default function complementLch(
|
|
15
|
+
color: Lchab,
|
|
16
|
+
n?: number
|
|
17
|
+
): ([number, number, number] & Lchab)[];
|
|
18
|
+
/**
|
|
19
|
+
* Determine the complementary color(s) of the given color.
|
|
20
|
+
* @param color - The color to find the complement(s) of in CIE-L\*Ch(uv).
|
|
21
|
+
* @param n - The number of complements to find. This can be `1` for a complementary color, `2` for triadic colors, `3` for tetradic colors, and so on.
|
|
22
|
+
* @returns The complements of the given color.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export default function complementLch(
|
|
26
|
+
color: Lchuv,
|
|
27
|
+
n?: number
|
|
28
|
+
): ([number, number, number] & Lchuv)[];
|
|
29
|
+
export default function complementLch(
|
|
30
|
+
color: Lchab | Lchuv,
|
|
31
|
+
n = 1
|
|
32
|
+
): ([number, number, number] & Lchab)[] | ([number, number, number] & Lchuv)[] {
|
|
33
|
+
const l = color[0];
|
|
34
|
+
|
|
35
|
+
const c = color[1];
|
|
36
|
+
|
|
37
|
+
const h = color[2];
|
|
38
|
+
|
|
39
|
+
const deltaAngle = d / (n + 1);
|
|
40
|
+
|
|
41
|
+
const out:
|
|
42
|
+
| ([number, number, number] & Lchab)[]
|
|
43
|
+
| ([number, number, number] & Lchuv)[] = [];
|
|
44
|
+
for (let i = 1; i <= n; i++) {
|
|
45
|
+
const angle = h + deltaAngle * i;
|
|
46
|
+
out.push([l, c, (angle > d ? angle - d : angle) / d]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type Hsi from "../types/Hsi.js";
|
|
2
|
+
import type Hsl from "../types/Hsl.js";
|
|
3
|
+
import type Hsv from "../types/Hsv.js";
|
|
4
|
+
|
|
5
|
+
/** Number of degrees in a circle. */
|
|
6
|
+
const d = 360;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Determine the split complementary colors of the given color.
|
|
10
|
+
* @param color - The color to find the split complements of in HSI.
|
|
11
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
12
|
+
* @returns The complements of the given color.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export default function splitComplement(
|
|
16
|
+
color: Hsi,
|
|
17
|
+
subdivisions?: number
|
|
18
|
+
): [[number, number, number] & Hsi, [number, number, number] & Hsi];
|
|
19
|
+
/**
|
|
20
|
+
* Determine the split complementary colors of the given color.
|
|
21
|
+
* @param color - The color to find the split complements of in HSL.
|
|
22
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
23
|
+
* @returns The complements of the given color.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export default function splitComplement(
|
|
27
|
+
color: Hsl,
|
|
28
|
+
subdivisions?: number
|
|
29
|
+
): [[number, number, number] & Hsl, [number, number, number] & Hsl];
|
|
30
|
+
/**
|
|
31
|
+
* Determine the split complementary colors of the given color.
|
|
32
|
+
* @param color - The color to find the split complements of in HSV.
|
|
33
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
34
|
+
* @returns The complements of the given color.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export default function splitComplement(
|
|
38
|
+
color: Hsv,
|
|
39
|
+
subdivisions?: number
|
|
40
|
+
): [[number, number, number] & Hsv, [number, number, number] & Hsv];
|
|
41
|
+
export default function splitComplement(
|
|
42
|
+
color: Hsi | Hsl | Hsv,
|
|
43
|
+
subdivisions = 12
|
|
44
|
+
):
|
|
45
|
+
| [[number, number, number] & Hsi, [number, number, number] & Hsi]
|
|
46
|
+
| [[number, number, number] & Hsl, [number, number, number] & Hsl]
|
|
47
|
+
| [[number, number, number] & Hsv, [number, number, number] & Hsv] {
|
|
48
|
+
const s = color[1];
|
|
49
|
+
|
|
50
|
+
const x = color[2];
|
|
51
|
+
|
|
52
|
+
const deltaAngle = d / subdivisions;
|
|
53
|
+
const oppositeAngle = color[0] * d + d / 2;
|
|
54
|
+
const underAngle = oppositeAngle - deltaAngle;
|
|
55
|
+
const overAngle = oppositeAngle + deltaAngle;
|
|
56
|
+
|
|
57
|
+
return [
|
|
58
|
+
[(underAngle > d ? underAngle - d : underAngle) / d, s, x],
|
|
59
|
+
[(overAngle > d ? overAngle - d : overAngle) / d, s, x]
|
|
60
|
+
];
|
|
61
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type Lchab from "../types/Lchab.js";
|
|
2
|
+
import type Lchuv from "../types/Lchuv.js";
|
|
3
|
+
|
|
4
|
+
/** Number of degrees in a circle. */
|
|
5
|
+
const d = 360;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Determine the split complementary colors of the given color.
|
|
9
|
+
* @param color - The color to find the split complements of in CIE-L\*Ch(ab).
|
|
10
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
11
|
+
* @returns The complements of the given color.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export default function splitComplementLch(
|
|
15
|
+
color: Lchab,
|
|
16
|
+
subdivisions?: number
|
|
17
|
+
): [[number, number, number] & Lchab, [number, number, number] & Lchab];
|
|
18
|
+
/**
|
|
19
|
+
* Determine the split complementary colors of the given color.
|
|
20
|
+
* @param color - The color to find the split complements of in CIE-L\*Ch(uv).
|
|
21
|
+
* @param subdivisions - The number of slices to divide the color wheel into.
|
|
22
|
+
* @returns The complements of the given color.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export default function splitComplementLch(
|
|
26
|
+
color: Lchuv,
|
|
27
|
+
subdivisions?: number
|
|
28
|
+
): [[number, number, number] & Lchuv, [number, number, number] & Lchuv];
|
|
29
|
+
export default function splitComplementLch(
|
|
30
|
+
color: Lchab | Lchuv,
|
|
31
|
+
subdivisions = 12
|
|
32
|
+
):
|
|
33
|
+
| [[number, number, number] & Lchab, [number, number, number] & Lchab]
|
|
34
|
+
| [[number, number, number] & Lchuv, [number, number, number] & Lchuv] {
|
|
35
|
+
const l = color[0];
|
|
36
|
+
|
|
37
|
+
const c = color[1];
|
|
38
|
+
|
|
39
|
+
const deltaAngle = d / subdivisions;
|
|
40
|
+
const oppositeAngle = color[2] + d / 2;
|
|
41
|
+
const underAngle = oppositeAngle - deltaAngle;
|
|
42
|
+
const overAngle = oppositeAngle + deltaAngle;
|
|
43
|
+
|
|
44
|
+
return [
|
|
45
|
+
[l, c, (underAngle > d ? underAngle - d : underAngle) / d],
|
|
46
|
+
[l, c, (overAngle > d ? overAngle - d : overAngle) / d]
|
|
47
|
+
];
|
|
48
|
+
}
|
package/src/types/Adobe.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Adobe extends Color {
|
|
9
9
|
/** The red channel of this color in the range `[0x00,0xff]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The green channel of this color in the range `[0x00,0xff]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The blue channel of this color in the range `[0x00,0xff]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Cmy.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Cmy extends Color {
|
|
9
9
|
/** The cyan channel of this color in the range `[0,1]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The magenta channel of this color in the range `[0,1]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The yellow channel of this color in the range `[0,1]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Cmyk.ts
CHANGED
|
@@ -7,14 +7,18 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Cmyk extends Color {
|
|
9
9
|
/** The cyan channel of this color in the range `[0,1]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The magenta channel of this color in the range `[0,1]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The yellow channel of this color in the range `[0,1]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
|
|
18
21
|
/** The key (black) channel of this color in the range `[0,1]`. */
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
23
|
3: number;
|
|
20
24
|
}
|
package/src/types/Hsi.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Color } from "./Color.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An HSI representation of a color. Commonly used in computer vision applications.
|
|
5
|
+
* @see {@link https://en.wikipedia.org/wiki/HSL_and_HSV | HSL and HSV}
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export default interface Hsi extends Color {
|
|
9
|
+
/** The hue channel of this color in the range `[0,1]`. Multiply this value by 360 to get the hue angle in degrees. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
0: number;
|
|
12
|
+
|
|
13
|
+
/** The saturation channel of this color in the range `[0,1]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
1: number;
|
|
16
|
+
|
|
17
|
+
/** The intensity channel of this color in the range `[0,1]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
+
2: number;
|
|
20
|
+
}
|
package/src/types/Hsl.ts
CHANGED
|
@@ -6,12 +6,15 @@ import type { Color } from "./Color.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default interface Hsl extends Color {
|
|
9
|
-
/** The hue channel of this color in the range `[0,1]`. */
|
|
9
|
+
/** The hue channel of this color in the range `[0,1]`. Multiply this value by 360 to get the hue angle in degrees. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The saturation channel of this color in the range `[0,1]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The lightness channel of this color in the range `[0,1]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Hsv.ts
CHANGED
|
@@ -6,12 +6,15 @@ import type { Color } from "./Color.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default interface Hsv extends Color {
|
|
9
|
-
/** The hue channel of this color in the range `[0,1]`. */
|
|
9
|
+
/** The hue channel of this color in the range `[0,1]`. Multiply this value by 360 to get the hue angle in degrees. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The saturation channel of this color in the range `[0,1]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The value (brightness) channel of this color in the range `[0,1]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Hunter.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Hunter extends Color {
|
|
9
9
|
/** The L (lightness) value of this color in the range `[0,100]` (lighter values are whiter). */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The a opponent color axis value of this color. The positive direction represents redness, while the negative direction represents greenness. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The b opponent color axis value of this color. The positive direction represents yellowness, while the negative direction represents blueness. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Lab.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { Color } from "./Color.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A CIELAB (L
|
|
4
|
+
* A CIELAB (L\*a\*b\* or CIE-L\*ab) representation of a color. Intended to be a perceptually uniform space. Derived from CIEXYZ. Colors are defined relative to a standard observer. Compared to CIELUV, CIELAB is considered better for reflective surface colors.
|
|
5
5
|
* @see {@link https://en.wikipedia.org/wiki/CIELAB_color_space | CIELAB color space}
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default interface Lab extends Color {
|
|
9
|
-
/** The L* (perceptual brightness) value of this color in the range `[0,100]`. */
|
|
9
|
+
/** The L* (luminance or perceptual brightness) value of this color in the range `[0,100]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The a* value of this color. Forms a Cartesian coordinate pair with b* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The b* value of this color. Forms a Cartesian coordinate pair with a* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Color } from "./Color.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A CIELCh (CIEHLC or CIE-L\*Ch(ab)) representation of a color. Intended to be a perceptually uniform space. Colors are defined relative to a standard observer.
|
|
5
|
+
* @see {@link https://en.wikipedia.org/wiki/CIELAB_color_space | CIELAB color space}
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export default interface Lchab extends Color {
|
|
9
|
+
/** The L* (luminance or perceptual brightness) value of this color in the range `[0,100]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
0: number;
|
|
12
|
+
|
|
13
|
+
/** The C* (chroma/chromaticity or relative saturation) value of this color. Forms a polar coordinate pair with h° to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
1: number;
|
|
16
|
+
|
|
17
|
+
/** The h° (hue angle) value of this color. Forms a polar coordinate pair with C* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
+
2: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Color } from "./Color.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A CIELCh (CIEHLC or CIE-L\*Ch(uv)) representation of a color. Intended to be a perceptually uniform space. Colors are defined relative to a standard observer.
|
|
5
|
+
* @see {@link https://en.wikipedia.org/wiki/CIELUV | CIELUV}
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export default interface Lchuv extends Color {
|
|
9
|
+
/** The L* (luminance or perceptual brightness) value of this color in the range `[0,100]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
0: number;
|
|
12
|
+
|
|
13
|
+
/** The C* (chroma/chromaticity or relative saturation) value of this color. Forms a polar coordinate pair with h° to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
+
1: number;
|
|
16
|
+
|
|
17
|
+
/** The h° (hue angle) value of this color. Forms a polar coordinate pair with C* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
+
2: number;
|
|
20
|
+
}
|
package/src/types/Luv.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import type { Color } from "./Color.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A CIELUV (CIE 1976 L
|
|
4
|
+
* A CIELUV (CIE 1976 L\*,u\*,v\* or CIE-L\*uv) representation of a color. Intended to be a perceptually uniform space. Derived from CIEXYZ. Colors are defined relative to a standard observer. Compared to CIELAB, CIELUV is considered better for emissive, self-illuminated colors (such as those on a monitor).
|
|
5
5
|
* @see {@link https://en.wikipedia.org/wiki/CIELUV | CIELUV}
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default interface Luv extends Color {
|
|
9
9
|
/** The L* (perceptual brightness) value of this color in the range `[0,100]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The u* value of this color. Forms a Cartesian coordinate pair with v* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The v* value of this color. Forms a Cartesian coordinate pair with u* to represent the four unique colors of human vision (red, green, blue, and yellow). */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Rgb.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Rgb extends Color {
|
|
9
9
|
/** The red channel of this color in the range `[0x00,0xff]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The green channel of this color in the range `[0x00,0xff]`. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The blue channel of this color in the range `[0x00,0xff]`. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Xyz.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Xyz extends Color {
|
|
9
9
|
/** The X value of this color. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The Y value of this color. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The Z value of this color. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|
package/src/types/Yxy.ts
CHANGED
|
@@ -7,11 +7,14 @@ import type { Color } from "./Color.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export default interface Yxy extends Color {
|
|
9
9
|
/** The Y value of this color in the range `[0,100]`. */
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
11
|
0: number;
|
|
11
12
|
|
|
12
13
|
/** The x value of this color. */
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
15
|
1: number;
|
|
14
16
|
|
|
15
17
|
/** The y value of this color. */
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
19
|
2: number;
|
|
17
20
|
}
|