color-map 2.1.0 → 2.3.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/.claude-plugin/plugin.json +12 -0
- package/.codex-plugin/plugin.json +12 -0
- package/.cursor-plugin/plugin.json +12 -0
- package/CHANGELOG.md +94 -0
- package/README.md +71 -11
- package/bin/cli-CNBftDBE.js +6414 -0
- package/bin/color-map.js +9 -0
- package/bin/index.js +1 -0
- package/cjs/color/index.d.ts +5 -0
- package/cjs/color/index.js +52 -0
- package/cjs/color-wNrkrhC7.js +374 -0
- package/cjs/color-wNrkrhC7.js.map +1 -0
- package/cjs/contrast-XjF5Rwui.js +293 -0
- package/cjs/contrast-XjF5Rwui.js.map +1 -0
- package/cjs/gamut-CG1J2aat.d.ts +158 -0
- package/cjs/gamut-CG1J2aat.d.ts.map +1 -0
- package/cjs/index-BcEqCPHz.d.ts +137 -0
- package/cjs/index-BcEqCPHz.d.ts.map +1 -0
- package/cjs/index-CGKCqRqD.d.ts +111 -0
- package/cjs/index-CGKCqRqD.d.ts.map +1 -0
- package/cjs/index-Cv3iUUYE.d.ts +171 -0
- package/cjs/index-Cv3iUUYE.d.ts.map +1 -0
- package/cjs/index-Dw43Hj4v.d.ts +41 -0
- package/cjs/index-Dw43Hj4v.d.ts.map +1 -0
- package/cjs/index-Dy8UARqO.d.ts +72 -0
- package/cjs/index-Dy8UARqO.d.ts.map +1 -0
- package/cjs/index.d.ts +27 -5
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +89 -20
- package/cjs/index.js.map +1 -1
- package/cjs/legacy/index.d.ts +2 -0
- package/cjs/legacy/index.js +75 -0
- package/cjs/legacy/index.js.map +1 -0
- package/cjs/mix-Cs4owSbW.js +158 -0
- package/cjs/mix-Cs4owSbW.js.map +1 -0
- package/cjs/mix-DGlKoUw4.d.ts +31 -0
- package/cjs/mix-DGlKoUw4.d.ts.map +1 -0
- package/cjs/package.json +1 -1
- package/cjs/palette/index.d.ts +3 -0
- package/cjs/palette/index.js +8 -0
- package/cjs/palette-DyFV_KoJ.js +332 -0
- package/cjs/palette-DyFV_KoJ.js.map +1 -0
- package/cjs/parse-8mt2OMKf.js +1508 -0
- package/cjs/parse-8mt2OMKf.js.map +1 -0
- package/cjs/scale/index.d.ts +2 -0
- package/cjs/scale/index.js +11 -0
- package/cjs/scale-Cq9pXrc1.js +318 -0
- package/cjs/scale-Cq9pXrc1.js.map +1 -0
- package/cjs/semantic-CrEIo8tS.d.ts +52 -0
- package/cjs/semantic-CrEIo8tS.d.ts.map +1 -0
- package/cjs/serialize-C69DAmoE.d.ts +25 -0
- package/cjs/serialize-C69DAmoE.d.ts.map +1 -0
- package/cjs/serialize-Ci2X0cPN.js +103 -0
- package/cjs/serialize-Ci2X0cPN.js.map +1 -0
- package/cjs/tokens/index.d.ts +2 -0
- package/cjs/tokens/index.js +6 -0
- package/cjs/tokens-CzXxaMgM.js +168 -0
- package/cjs/tokens-CzXxaMgM.js.map +1 -0
- package/cjs/tone-BAhu-QzQ.js +118 -0
- package/cjs/tone-BAhu-QzQ.js.map +1 -0
- package/dist/color-map.es5.js +1 -1
- package/dist/color-map.es5.js.map +1 -1
- package/esm/color/a98-rgb.d.ts +7 -0
- package/esm/color/a98-rgb.d.ts.map +1 -0
- package/esm/color/a98-rgb.js +13 -0
- package/esm/color/a98-rgb.js.map +1 -0
- package/esm/color/argb.d.ts +6 -0
- package/esm/color/argb.d.ts.map +1 -0
- package/esm/color/argb.js +25 -0
- package/esm/color/argb.js.map +1 -0
- package/esm/color/calc.js +82 -0
- package/esm/color/calc.js.map +1 -0
- package/esm/color/compare.d.ts +20 -0
- package/esm/color/compare.d.ts.map +1 -0
- package/esm/color/compare.js +46 -0
- package/esm/color/compare.js.map +1 -0
- package/esm/color/contrast.d.ts +107 -0
- package/esm/color/contrast.d.ts.map +1 -0
- package/esm/color/contrast.js +242 -0
- package/esm/color/contrast.js.map +1 -0
- package/esm/color/convert.d.ts +9 -0
- package/esm/color/convert.d.ts.map +1 -0
- package/esm/color/convert.js +45 -0
- package/esm/color/convert.js.map +1 -0
- package/esm/color/display-p3-linear.d.ts +7 -0
- package/esm/color/display-p3-linear.d.ts.map +1 -0
- package/esm/color/display-p3-linear.js +12 -0
- package/esm/color/display-p3-linear.js.map +1 -0
- package/esm/color/display-p3.d.ts +7 -0
- package/esm/color/display-p3.d.ts.map +1 -0
- package/esm/color/display-p3.js +12 -0
- package/esm/color/display-p3.js.map +1 -0
- package/esm/color/expr.d.ts +43 -0
- package/esm/color/expr.d.ts.map +1 -0
- package/esm/color/expr.js +160 -0
- package/esm/color/expr.js.map +1 -0
- package/esm/color/gamut.d.ts +31 -0
- package/esm/color/gamut.d.ts.map +1 -0
- package/esm/color/gamut.js +210 -0
- package/esm/color/gamut.js.map +1 -0
- package/esm/color/hsl.d.ts +7 -0
- package/esm/color/hsl.d.ts.map +1 -0
- package/esm/color/hsl.js +67 -0
- package/esm/color/hsl.js.map +1 -0
- package/esm/color/hwb.d.ts +7 -0
- package/esm/color/hwb.d.ts.map +1 -0
- package/esm/color/hwb.js +40 -0
- package/esm/color/hwb.js.map +1 -0
- package/esm/color/index.d.ts +28 -0
- package/esm/color/index.js +27 -0
- package/esm/color/lab.d.ts +7 -0
- package/esm/color/lab.d.ts.map +1 -0
- package/esm/color/lab.js +33 -0
- package/esm/color/lab.js.map +1 -0
- package/esm/color/lch.d.ts +7 -0
- package/esm/color/lch.d.ts.map +1 -0
- package/esm/color/lch.js +11 -0
- package/esm/color/lch.js.map +1 -0
- package/esm/color/math.js +32 -0
- package/esm/color/math.js.map +1 -0
- package/esm/color/matrices.js +180 -0
- package/esm/color/matrices.js.map +1 -0
- package/esm/color/mix.d.ts +30 -0
- package/esm/color/mix.d.ts.map +1 -0
- package/esm/color/mix.js +152 -0
- package/esm/color/mix.js.map +1 -0
- package/esm/color/named.js +11 -0
- package/esm/color/named.js.map +1 -0
- package/esm/color/oklab.d.ts +7 -0
- package/esm/color/oklab.d.ts.map +1 -0
- package/esm/color/oklab.js +21 -0
- package/esm/color/oklab.js.map +1 -0
- package/esm/color/oklch.d.ts +7 -0
- package/esm/color/oklch.d.ts.map +1 -0
- package/esm/color/oklch.js +11 -0
- package/esm/color/oklch.js.map +1 -0
- package/esm/color/parse.d.ts +9 -0
- package/esm/color/parse.d.ts.map +1 -0
- package/esm/color/parse.js +452 -0
- package/esm/color/parse.js.map +1 -0
- package/esm/color/polar.js +27 -0
- package/esm/color/polar.js.map +1 -0
- package/esm/color/prophoto-rgb.d.ts +7 -0
- package/esm/color/prophoto-rgb.d.ts.map +1 -0
- package/esm/color/prophoto-rgb.js +18 -0
- package/esm/color/prophoto-rgb.js.map +1 -0
- package/esm/color/rec2020.d.ts +7 -0
- package/esm/color/rec2020.d.ts.map +1 -0
- package/esm/color/rec2020.js +13 -0
- package/esm/color/rec2020.js.map +1 -0
- package/esm/color/resolve.d.ts +18 -0
- package/esm/color/resolve.d.ts.map +1 -0
- package/esm/color/resolve.js +98 -0
- package/esm/color/resolve.js.map +1 -0
- package/esm/color/rgb.js +20 -0
- package/esm/color/rgb.js.map +1 -0
- package/esm/color/serialize.d.ts +24 -0
- package/esm/color/serialize.d.ts.map +1 -0
- package/esm/color/serialize.js +88 -0
- package/esm/color/serialize.js.map +1 -0
- package/esm/color/spaces.d.ts +6 -0
- package/esm/color/spaces.d.ts.map +1 -0
- package/esm/color/spaces.js +42 -0
- package/esm/color/spaces.js.map +1 -0
- package/esm/color/srgb-linear.d.ts +7 -0
- package/esm/color/srgb-linear.d.ts.map +1 -0
- package/esm/color/srgb-linear.js +12 -0
- package/esm/color/srgb-linear.js.map +1 -0
- package/esm/color/srgb.d.ts +7 -0
- package/esm/color/srgb.d.ts.map +1 -0
- package/esm/color/srgb.js +12 -0
- package/esm/color/srgb.js.map +1 -0
- package/esm/color/transfer.js +11 -0
- package/esm/color/transfer.js.map +1 -0
- package/esm/color/types.d.ts +23 -0
- package/esm/color/types.d.ts.map +1 -0
- package/esm/color/unknown-name.js +16 -0
- package/esm/color/unknown-name.js.map +1 -0
- package/esm/color/xyz-d50.d.ts +7 -0
- package/esm/color/xyz-d50.d.ts.map +1 -0
- package/esm/color/xyz-d50.js +15 -0
- package/esm/color/xyz-d50.js.map +1 -0
- package/esm/color/xyz-d65.d.ts +4 -0
- package/esm/color/xyz-d65.d.ts.map +1 -0
- package/esm/color/xyz-d65.js +10 -0
- package/esm/color/xyz-d65.js.map +1 -0
- package/esm/index.d.ts +63 -5
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +53 -4
- package/esm/index.js.map +1 -1
- package/esm/legacy/createColors.d.ts +9 -0
- package/esm/legacy/createColors.d.ts.map +1 -0
- package/esm/legacy/createColors.js +32 -0
- package/esm/legacy/createColors.js.map +1 -0
- package/esm/legacy/createColorsFromMap.d.ts +9 -0
- package/esm/legacy/createColorsFromMap.d.ts.map +1 -0
- package/esm/legacy/createColorsFromMap.js +24 -0
- package/esm/legacy/createColorsFromMap.js.map +1 -0
- package/esm/legacy/index.d.ts +6 -0
- package/esm/legacy/index.js +5 -0
- package/esm/legacy/interfaces.d.ts +19 -0
- package/esm/legacy/interfaces.d.ts.map +1 -0
- package/esm/{rgbHex.d.ts → legacy/rgbHex.d.ts} +2 -1
- package/esm/legacy/rgbHex.d.ts.map +1 -0
- package/esm/legacy/rgbHex.js +17 -0
- package/esm/legacy/rgbHex.js.map +1 -0
- package/esm/legacy/rgbaString.d.ts +4 -0
- package/esm/legacy/rgbaString.d.ts.map +1 -0
- package/esm/legacy/rgbaString.js +8 -0
- package/esm/legacy/rgbaString.js.map +1 -0
- package/esm/palette/dark.d.ts +23 -0
- package/esm/palette/dark.d.ts.map +1 -0
- package/esm/palette/dark.js +54 -0
- package/esm/palette/dark.js.map +1 -0
- package/esm/palette/harmony.d.ts +56 -0
- package/esm/palette/harmony.d.ts.map +1 -0
- package/esm/palette/harmony.js +115 -0
- package/esm/palette/harmony.js.map +1 -0
- package/esm/palette/index.d.ts +5 -0
- package/esm/palette/index.js +5 -0
- package/esm/palette/semantic.d.ts +53 -0
- package/esm/palette/semantic.d.ts.map +1 -0
- package/esm/palette/semantic.js +96 -0
- package/esm/palette/semantic.js.map +1 -0
- package/esm/palette/validate.d.ts +39 -0
- package/esm/palette/validate.d.ts.map +1 -0
- package/esm/palette/validate.js +56 -0
- package/esm/palette/validate.js.map +1 -0
- package/esm/scale/brand.d.ts +21 -0
- package/esm/scale/brand.d.ts.map +1 -0
- package/esm/scale/brand.js +63 -0
- package/esm/scale/brand.js.map +1 -0
- package/esm/scale/contrast-scale.d.ts +33 -0
- package/esm/scale/contrast-scale.d.ts.map +1 -0
- package/esm/scale/contrast-scale.js +26 -0
- package/esm/scale/contrast-scale.js.map +1 -0
- package/esm/scale/gradient.d.ts +38 -0
- package/esm/scale/gradient.d.ts.map +1 -0
- package/esm/scale/gradient.js +73 -0
- package/esm/scale/gradient.js.map +1 -0
- package/esm/scale/index.d.ts +6 -0
- package/esm/scale/index.js +6 -0
- package/esm/scale/scale.d.ts +31 -0
- package/esm/scale/scale.d.ts.map +1 -0
- package/esm/scale/scale.js +152 -0
- package/esm/scale/scale.js.map +1 -0
- package/esm/scale/tone.d.ts +25 -0
- package/esm/scale/tone.d.ts.map +1 -0
- package/esm/scale/tone.js +96 -0
- package/esm/scale/tone.js.map +1 -0
- package/esm/tokens/css.d.ts +18 -0
- package/esm/tokens/css.d.ts.map +1 -0
- package/esm/tokens/css.js +23 -0
- package/esm/tokens/css.js.map +1 -0
- package/esm/tokens/dtcg.d.ts +33 -0
- package/esm/tokens/dtcg.d.ts.map +1 -0
- package/esm/tokens/dtcg.js +42 -0
- package/esm/tokens/dtcg.js.map +1 -0
- package/esm/tokens/index.d.ts +5 -0
- package/esm/tokens/index.js +4 -0
- package/esm/tokens/tailwind.d.ts +19 -0
- package/esm/tokens/tailwind.d.ts.map +1 -0
- package/esm/tokens/tailwind.js +19 -0
- package/esm/tokens/tailwind.js.map +1 -0
- package/esm/tokens/tokens.d.ts +11 -0
- package/esm/tokens/tokens.d.ts.map +1 -0
- package/esm/tokens/tokens.js +77 -0
- package/esm/tokens/tokens.js.map +1 -0
- package/llms.txt +29 -0
- package/package.json +240 -56
- package/plugin.json +18 -0
- package/schemas/contrast.schema.json +24 -0
- package/schemas/convert.schema.json +60 -0
- package/schemas/export.schema.json +106 -0
- package/schemas/find-contrast.schema.json +51 -0
- package/schemas/harmony.schema.json +58 -0
- package/schemas/mix.schema.json +72 -0
- package/schemas/palette.schema.json +56 -0
- package/schemas/scale.schema.json +86 -0
- package/skills/color-map/SKILL.md +38 -0
- package/src/cli/bin.ts +11 -0
- package/src/cli/cli.ts +40 -0
- package/src/cli/commands/contrast.ts +36 -0
- package/src/cli/commands/convert.ts +37 -0
- package/src/cli/commands/export.ts +102 -0
- package/src/cli/commands/find-contrast.ts +37 -0
- package/src/cli/commands/harmony.ts +30 -0
- package/src/cli/commands/mix.ts +29 -0
- package/src/cli/commands/palette.ts +66 -0
- package/src/cli/commands/scale.ts +75 -0
- package/src/cli/index.ts +2 -0
- package/src/cli/schema-command.ts +31 -0
- package/src/cli/schemas.ts +86 -0
- package/src/cli/shared.ts +72 -0
- package/src/cli/testing.ts +27 -0
- package/src/color/a98-rgb.ts +11 -0
- package/src/color/argb.ts +21 -0
- package/src/color/calc.ts +84 -0
- package/src/color/compare.ts +53 -0
- package/src/color/contrast.ts +277 -0
- package/src/color/convert.ts +43 -0
- package/src/color/display-p3-linear.ts +9 -0
- package/src/color/display-p3.ts +9 -0
- package/src/color/expr.ts +158 -0
- package/src/color/gamut.ts +215 -0
- package/src/color/hsl.ts +57 -0
- package/src/color/hwb.ts +26 -0
- package/src/color/index.ts +43 -0
- package/src/color/lab.ts +29 -0
- package/src/color/lch.ts +8 -0
- package/src/color/math.ts +30 -0
- package/src/color/matrices.ts +91 -0
- package/src/color/mix.ts +158 -0
- package/src/color/named.ts +13 -0
- package/src/color/oklab.ts +19 -0
- package/src/color/oklch.ts +8 -0
- package/src/color/parse.ts +355 -0
- package/src/color/polar.ts +17 -0
- package/src/color/prophoto-rgb.ts +18 -0
- package/src/color/rec2020.ts +11 -0
- package/src/color/resolve.ts +87 -0
- package/src/color/rgb.ts +20 -0
- package/src/color/serialize.ts +96 -0
- package/src/color/spaces.ts +42 -0
- package/src/color/srgb-linear.ts +9 -0
- package/src/color/srgb.ts +9 -0
- package/src/color/test-utils.ts +10 -0
- package/src/color/transfer.ts +14 -0
- package/src/color/types.ts +41 -0
- package/src/color/unknown-name.ts +15 -0
- package/src/color/xyz-d50.ts +13 -0
- package/src/color/xyz-d65.ts +8 -0
- package/src/index.ts +37 -0
- package/src/legacy/createColors.ts +36 -0
- package/src/legacy/createColorsFromMap.ts +29 -0
- package/src/legacy/interfaces.ts +19 -0
- package/{ts → src/legacy}/rgbHex.ts +7 -7
- package/src/legacy/rgbaString.ts +6 -0
- package/src/palette/dark.ts +55 -0
- package/src/palette/harmony.ts +107 -0
- package/src/palette/index.ts +18 -0
- package/src/palette/semantic.ts +120 -0
- package/src/palette/validate.ts +82 -0
- package/src/scale/brand.ts +50 -0
- package/src/scale/contrast-scale.ts +48 -0
- package/src/scale/gradient.ts +91 -0
- package/src/scale/index.ts +5 -0
- package/src/scale/scale.ts +127 -0
- package/src/scale/tone.ts +69 -0
- package/src/tokens/css.ts +32 -0
- package/src/tokens/dtcg.ts +62 -0
- package/src/tokens/index.ts +11 -0
- package/src/tokens/tailwind.ts +24 -0
- package/src/tokens/tokens.ts +82 -0
- package/cjs/createColors.d.ts +0 -2
- package/cjs/createColors.js +0 -40
- package/cjs/createColors.js.map +0 -1
- package/cjs/createColors.spec.d.ts +0 -1
- package/cjs/createColors.spec.js +0 -176
- package/cjs/createColors.spec.js.map +0 -1
- package/cjs/createColorsFromMap.d.ts +0 -5
- package/cjs/createColorsFromMap.js +0 -25
- package/cjs/createColorsFromMap.js.map +0 -1
- package/cjs/createColorsFromMap.spec.d.ts +0 -1
- package/cjs/createColorsFromMap.spec.js +0 -11
- package/cjs/createColorsFromMap.spec.js.map +0 -1
- package/cjs/interfaces.d.ts +0 -14
- package/cjs/interfaces.js +0 -3
- package/cjs/interfaces.js.map +0 -1
- package/cjs/rgbHex.d.ts +0 -6
- package/cjs/rgbHex.js +0 -19
- package/cjs/rgbHex.js.map +0 -1
- package/cjs/rgbHex.spec.d.ts +0 -1
- package/cjs/rgbHex.spec.js +0 -16
- package/cjs/rgbHex.spec.js.map +0 -1
- package/cjs/rgbaString.d.ts +0 -2
- package/cjs/rgbaString.js +0 -7
- package/cjs/rgbaString.js.map +0 -1
- package/cjs/rgbaString.spec.d.ts +0 -1
- package/cjs/rgbaString.spec.js +0 -10
- package/cjs/rgbaString.spec.js.map +0 -1
- package/esm/createColors.d.ts +0 -2
- package/esm/createColors.js +0 -27
- package/esm/createColors.js.map +0 -1
- package/esm/createColors.spec.d.ts +0 -1
- package/esm/createColors.spec.js +0 -171
- package/esm/createColors.spec.js.map +0 -1
- package/esm/createColorsFromMap.d.ts +0 -5
- package/esm/createColorsFromMap.js +0 -22
- package/esm/createColorsFromMap.js.map +0 -1
- package/esm/createColorsFromMap.spec.d.ts +0 -1
- package/esm/createColorsFromMap.spec.js +0 -9
- package/esm/createColorsFromMap.spec.js.map +0 -1
- package/esm/interfaces.d.ts +0 -14
- package/esm/interfaces.js +0 -2
- package/esm/interfaces.js.map +0 -1
- package/esm/rgbHex.js +0 -16
- package/esm/rgbHex.js.map +0 -1
- package/esm/rgbHex.spec.d.ts +0 -1
- package/esm/rgbHex.spec.js +0 -14
- package/esm/rgbHex.spec.js.map +0 -1
- package/esm/rgbaString.d.ts +0 -2
- package/esm/rgbaString.js +0 -4
- package/esm/rgbaString.js.map +0 -1
- package/esm/rgbaString.spec.d.ts +0 -1
- package/esm/rgbaString.spec.js +0 -8
- package/esm/rgbaString.spec.js.map +0 -1
- package/ts/createColors.ts +0 -35
- package/ts/createColorsFromMap.ts +0 -26
- package/ts/interfaces.ts +0 -15
- package/ts/rgbaString.ts +0 -5
- package/{ts → src/legacy}/index.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/tokens/tokens.ts"],"sourcesContent":["import { parse } from '../color/parse.js'\nimport type { Color } from '../color/types.js'\nimport type { SemanticPalette } from '../palette/semantic.js'\n\n/**\n * What the exporters accept: a color, a CSS color string, an array of them (a\n * scale), or an object of any of these nested to any depth. A `SemanticPalette`\n * works as is: its `scales` and its role pairs export, its `meta` and ratios do not.\n */\nexport type TokenTree = SemanticPalette | Color | string | readonly TokenTree[] | { readonly [name: string]: TokenTree }\n\n/** A color and the path of names that leads to it. */\nexport interface Token {\n\tpath: string[]\n\tcolor: Color\n}\n\nconst TAILWIND_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]\n\nconst isColor = (v: unknown): v is Color =>\n\ttypeof v === 'object' &&\n\tv !== null &&\n\ttypeof (v as Color).colorSpace === 'string' &&\n\tArray.isArray((v as Color).components)\n\n// A semantic palette carries numbers (`ratio`, `target`, `meta`) that are not colors.\nfunction dropMeasures(tree: Record<string, unknown>): Record<string, unknown> {\n\tconst { meta: _meta, scales, roles, ...rest } = tree\n\tconst pairs = Object.fromEntries(\n\t\tObject.entries(roles as Record<string, { bg: Color; fg: Color }>).map(([name, p]) => [name, { bg: p.bg, fg: p.fg }])\n\t)\n\treturn { ...rest, ...(scales as object), roles: pairs }\n}\n\nconst isSemantic = (v: object): boolean => 'roles' in v && 'scales' in v && 'meta' in v\n\n/**\n * Walks a token tree into a flat list. An array gets the Tailwind keys\n * (50 to 950) when it has 11 colors and 1-based numbers otherwise; pass an\n * object to choose the keys. A value that is not a color, a string, an array\n * or an object throws with its path.\n */\nexport function flatten(tree: TokenTree): Token[] {\n\tconst out: Token[] = []\n\tconst walk = (node: unknown, path: string[]): void => {\n\t\tif (typeof node === 'string') return void out.push({ path, color: parse(node) })\n\t\tif (isColor(node)) return void out.push({ path, color: node })\n\t\tif (Array.isArray(node)) {\n\t\t\tnode.forEach((v, i) => {\n\t\t\t\twalk(v, [...path, String(node.length === TAILWIND_STEPS.length ? TAILWIND_STEPS[i] : i + 1)])\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tif (typeof node === 'object' && node !== null) {\n\t\t\tconst obj = isSemantic(node) ? dropMeasures(node as Record<string, unknown>) : (node as Record<string, unknown>)\n\t\t\tfor (const [k, v] of Object.entries(obj)) walk(v, [...path, k])\n\t\t\treturn\n\t\t}\n\t\tthrow new TypeError(`${path.join('.') || '(root)'} is not a color, a string, an array or an object`)\n\t}\n\twalk(tree, [])\n\treturn out\n}\n\n/** `primaryContainer` and `Primary Container` both become `primary-container`. */\nexport const kebab = (name: string): string =>\n\tname\n\t\t.replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n\t\t.replace(/[^a-zA-Z0-9]+/g, '-')\n\t\t.replace(/^-+|-+$/g, '')\n\t\t.toLowerCase()\n\n/** Names tokens for CSS: kebab-case segments joined by `-` after `prefix`. Two tokens with one name throw. */\nexport function cssNames(tokens: Token[], prefix: string): Map<string, Color> {\n\tconst out = new Map<string, Color>()\n\tfor (const { path, color } of tokens) {\n\t\tconst name = `--${[prefix, ...path].map(kebab).filter(Boolean).join('-')}`\n\t\tif (out.has(name)) throw new Error(`${name} is produced by more than one token`)\n\t\tout.set(name, color)\n\t}\n\treturn out\n}\n"],"mappings":";;AAiBA,MAAM,iBAAiB;CAAC;CAAI;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;AAE5E,MAAM,WAAW,MAChB,OAAO,MAAM,YACb,MAAM,QACN,OAAQ,EAAY,eAAe,YACnC,MAAM,QAAS,EAAY,UAAU;AAGtC,SAAS,aAAa,MAAwD;CAC7E,MAAM,EAAE,MAAM,OAAO,QAAQ,OAAO,GAAG,SAAS;CAChD,MAAM,QAAQ,OAAO,YACpB,OAAO,QAAQ,KAAiD,CAAC,CAAC,KAAK,CAAC,MAAM,OAAO,CAAC,MAAM;EAAE,IAAI,EAAE;EAAI,IAAI,EAAE;CAAG,CAAC,CAAC,CACpH;CACA,OAAO;EAAE,GAAG;EAAM,GAAI;EAAmB,OAAO;CAAM;AACvD;AAEA,MAAM,cAAc,MAAuB,WAAW,KAAK,YAAY,KAAK,UAAU;;;;;;;AAQtF,SAAgB,QAAQ,MAA0B;CACjD,MAAM,MAAe,CAAC;CACtB,MAAM,QAAQ,MAAe,SAAyB;EACrD,IAAI,OAAO,SAAS,UAAU,OAAO,KAAK,IAAI,KAAK;GAAE;GAAM,OAAO,MAAM,IAAI;EAAE,CAAC;EAC/E,IAAI,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,KAAK;GAAE;GAAM,OAAO;EAAK,CAAC;EAC7D,IAAI,MAAM,QAAQ,IAAI,GAAG;GACxB,KAAK,SAAS,GAAG,MAAM;IACtB,KAAK,GAAG,CAAC,GAAG,MAAM,OAAO,KAAK,WAAW,eAAe,SAAS,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC;GAC7F,CAAC;GACD;EACD;EACA,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;GAC9C,MAAM,MAAM,WAAW,IAAI,IAAI,aAAa,IAA+B,IAAK;GAChF,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,GAAG,GAAG,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;GAC9D;EACD;EACA,MAAM,IAAI,UAAU,GAAG,KAAK,KAAK,GAAG,KAAK,SAAS,iDAAiD;CACpG;CACA,KAAK,MAAM,CAAC,CAAC;CACb,OAAO;AACR;;AAGA,MAAa,SAAS,SACrB,KACE,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,kBAAkB,GAAG,CAAC,CAC9B,QAAQ,YAAY,EAAE,CAAC,CACvB,YAAY;;AAGf,SAAgB,SAAS,QAAiB,QAAoC;CAC7E,MAAM,sBAAM,IAAI,IAAmB;CACnC,KAAK,MAAM,EAAE,MAAM,WAAW,QAAQ;EACrC,MAAM,OAAO,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACvE,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,IAAI,MAAM,GAAG,KAAK,oCAAoC;EAC/E,IAAI,IAAI,MAAM,KAAK;CACpB;CACA,OAAO;AACR"}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# color-map
|
|
2
|
+
|
|
3
|
+
> The `color-map` command: convert, mix, contrast-check, scale and export CSS colors, and build a semantic palette whose text pairs all pass WCAG 2, from one brand color.
|
|
4
|
+
|
|
5
|
+
This file is generated by `scripts/generate-llms-txt.mjs` from the command table. Do not edit it.
|
|
6
|
+
|
|
7
|
+
Conventions that hold for every command:
|
|
8
|
+
|
|
9
|
+
- Output is TOON on stdout by default; `--format json` gives JSON. Diagnostics go to stderr.
|
|
10
|
+
- Colors are any CSS color string, including `color-mix()` and relative colors.
|
|
11
|
+
- Contrast is WCAG 2. There is no other contrast algorithm.
|
|
12
|
+
- `--full` adds every field. Empty results say so explicitly.
|
|
13
|
+
- A failure exits 1 or 2 with `error`, `code` and `help` fields on stdout. Nothing prompts; unknown options fail.
|
|
14
|
+
- Run it with `npx color-map <command>`, or install the `color-map` agent skill from this package.
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
- [convert](https://unpkg.com/color-map/schemas/convert.schema.json): Convert a CSS color to another color space. Usage: `color-map convert <color>` with --to, --gamut, --full.
|
|
19
|
+
- [mix](https://unpkg.com/color-map/schemas/mix.schema.json): Mix two CSS colors, as color-mix() does. Usage: `color-map mix <a> <b>` with --amount, --in, --hue, --full.
|
|
20
|
+
- [contrast](https://unpkg.com/color-map/schemas/contrast.schema.json): WCAG 2 contrast ratio of a text color on a background, with the AA and AAA verdicts. Usage: `color-map contrast <fg> <bg>` with no options.
|
|
21
|
+
- [find-contrast](https://unpkg.com/color-map/schemas/find-contrast.schema.json): Find the color closest in lightness to a background that reaches a WCAG 2 contrast target. Usage: `color-map find-contrast <bg>` with --target, --hue, --chroma, --direction, --full.
|
|
22
|
+
- [scale](https://unpkg.com/color-map/schemas/scale.schema.json): Build a color scale from a seed color: a preset, a Radix-style brand scale, or contrast targets. Usage: `color-map scale <seed>` with --preset, --steps, --brand, --mode, --background, --targets, --gamut, --full.
|
|
23
|
+
- [palette](https://unpkg.com/color-map/schemas/palette.schema.json): A semantic palette from one brand color: primary, status colors, surface and outline, each with a text color and its WCAG 2 ratio. Usage: `color-map palette <brand>` with --mode, --target, --gamut, --full.
|
|
24
|
+
- [harmony](https://unpkg.com/color-map/schemas/harmony.schema.json): The colors of a harmony scheme: the color rotated around the hue wheel. Usage: `color-map harmony <color>` with --scheme, --space, --gamut.
|
|
25
|
+
- [export](https://unpkg.com/color-map/schemas/export.schema.json): Write a palette, a scale or your own tokens as DTCG JSON, CSS variables or a Tailwind v4 theme. Usage: `color-map export [color]` with --to, --source, --mode, --tokens, --space, --prefix, --selector, --namespace, --inline, --precision, --hex.
|
|
26
|
+
|
|
27
|
+
## Optional
|
|
28
|
+
|
|
29
|
+
- [Source and README](https://github.com/cyberuni/color-map): the color-map library and CLI.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-map",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Color map generator",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "Color map generator and color toolkit: a library, a CLI and an agent skill",
|
|
5
5
|
"homepage": "https://github.com/cyberuni/color-map",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/cyberuni/color-map/issues"
|
|
@@ -16,78 +16,262 @@
|
|
|
16
16
|
"email": "homawong@gmail.com"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
|
+
"sideEffects": false,
|
|
19
20
|
"exports": {
|
|
20
|
-
"
|
|
21
|
-
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./esm/index.d.ts",
|
|
23
|
+
"import": "./esm/index.js",
|
|
24
|
+
"require": "./cjs/index.js",
|
|
25
|
+
"default": "./cjs/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./color": {
|
|
28
|
+
"types": "./esm/color/index.d.ts",
|
|
29
|
+
"import": "./esm/color/index.js",
|
|
30
|
+
"require": "./cjs/color/index.js",
|
|
31
|
+
"default": "./cjs/color/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./legacy": {
|
|
34
|
+
"types": "./esm/legacy/index.d.ts",
|
|
35
|
+
"import": "./esm/legacy/index.js",
|
|
36
|
+
"require": "./cjs/legacy/index.js",
|
|
37
|
+
"default": "./cjs/legacy/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./palette": {
|
|
40
|
+
"types": "./esm/palette/index.d.ts",
|
|
41
|
+
"import": "./esm/palette/index.js",
|
|
42
|
+
"require": "./cjs/palette/index.js",
|
|
43
|
+
"default": "./cjs/palette/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./scale": {
|
|
46
|
+
"types": "./esm/scale/index.d.ts",
|
|
47
|
+
"import": "./esm/scale/index.js",
|
|
48
|
+
"require": "./cjs/scale/index.js",
|
|
49
|
+
"default": "./cjs/scale/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./tokens": {
|
|
52
|
+
"types": "./esm/tokens/index.d.ts",
|
|
53
|
+
"import": "./esm/tokens/index.js",
|
|
54
|
+
"require": "./cjs/tokens/index.js",
|
|
55
|
+
"default": "./cjs/tokens/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./schemas/*": "./schemas/*",
|
|
58
|
+
"./package.json": "./package.json"
|
|
22
59
|
},
|
|
23
60
|
"main": "./cjs/index.js",
|
|
24
61
|
"types": "./esm/index.d.ts",
|
|
25
62
|
"files": [
|
|
63
|
+
"bin",
|
|
26
64
|
"cjs",
|
|
27
65
|
"dist",
|
|
28
66
|
"esm",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
67
|
+
"schemas",
|
|
68
|
+
"skills",
|
|
69
|
+
"src",
|
|
70
|
+
"llms.txt",
|
|
71
|
+
"plugin.json",
|
|
72
|
+
".claude-plugin",
|
|
73
|
+
".codex-plugin",
|
|
74
|
+
".cursor-plugin",
|
|
75
|
+
"!**/*.spec.*",
|
|
76
|
+
"CHANGELOG.md"
|
|
31
77
|
],
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "run-p build:cjs build:esm build:tslib bundle",
|
|
34
|
-
"build:cjs": "tsc -p tsconfig.cjs.json && ncp package.cjs.json cjs/package.json",
|
|
35
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
36
|
-
"build:tslib": "tsc -p tsconfig.tslib.json && ncp package.cjs.json tslib/package.json",
|
|
37
|
-
"bundle": "webpack",
|
|
38
|
-
"clean": "rimraf .reports cjs coverage esm lib libm tslib",
|
|
39
|
-
"coverage": "jest --coverage",
|
|
40
|
-
"depcheck": "depcheck",
|
|
41
|
-
"lint": "eslint --ext=js,ts .",
|
|
42
|
-
"nuke": "pnpm clean && rimraf node_modules",
|
|
43
|
-
"size": "size-limit",
|
|
44
|
-
"test": "jest",
|
|
45
|
-
"verify": "npm-run-all -p build depcheck lint coverage -p size",
|
|
46
|
-
"watch": "jest --watch"
|
|
47
|
-
},
|
|
48
78
|
"devDependencies": {
|
|
49
|
-
"@
|
|
50
|
-
"@size-limit/preset-small-lib": "^
|
|
51
|
-
"@types/
|
|
79
|
+
"@colordx/core": "7.3.0",
|
|
80
|
+
"@size-limit/preset-small-lib": "^14.3.0",
|
|
81
|
+
"@types/culori": "^4.0.1",
|
|
52
82
|
"@types/node": "^26.2.0",
|
|
53
|
-
"@
|
|
83
|
+
"@vitest/coverage-v8": "^5.0.0",
|
|
54
84
|
"assertron": "^11.0.0",
|
|
85
|
+
"clibuilder": "~12.1.0",
|
|
86
|
+
"colorjs.io": "0.7.1",
|
|
87
|
+
"culori": "4.0.2",
|
|
55
88
|
"depcheck": "^1.4.3",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"jest-watch-typeahead": "^2.0.0",
|
|
66
|
-
"ncp": "^2.0.0",
|
|
67
|
-
"npm-run-all": "^4.1.5",
|
|
68
|
-
"param-case": "^3.0.4",
|
|
69
|
-
"pascal-case": "^3.1.2",
|
|
70
|
-
"rimraf": "^5.0.0",
|
|
71
|
-
"size-limit": "^9.0.0",
|
|
72
|
-
"ts-jest": "^29.0.0",
|
|
73
|
-
"ts-loader": "^9.3.0",
|
|
74
|
-
"tslib": "^2.4.0",
|
|
75
|
-
"typescript": "^5.0.0",
|
|
76
|
-
"webpack": "^5.73.0",
|
|
77
|
-
"webpack-cli": "^5.0.0"
|
|
89
|
+
"npm-run-all2": "^9.0.3",
|
|
90
|
+
"rimraf": "^6.1.3",
|
|
91
|
+
"size-limit": "^14.3.0",
|
|
92
|
+
"tsdown": "^0.23.0",
|
|
93
|
+
"typescript": "^7.0.2",
|
|
94
|
+
"vitest": "^5.0.0"
|
|
95
|
+
},
|
|
96
|
+
"engines": {
|
|
97
|
+
"node": ">= 20.19"
|
|
78
98
|
},
|
|
79
99
|
"size-limit": [
|
|
80
100
|
{
|
|
81
|
-
"
|
|
82
|
-
"
|
|
101
|
+
"name": "existing API",
|
|
102
|
+
"path": "esm/legacy/index.js",
|
|
103
|
+
"import": "{ createColors, createColorsFromMap, rgbHex, rgbaString }",
|
|
104
|
+
"limit": "0.45 kB",
|
|
105
|
+
"gzip": true
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "existing API from the root",
|
|
109
|
+
"path": "esm/index.js",
|
|
110
|
+
"import": "{ createColors, createColorsFromMap, rgbHex, rgbaString }",
|
|
111
|
+
"limit": "0.45 kB",
|
|
112
|
+
"gzip": true
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "convert between two spaces",
|
|
116
|
+
"path": "esm/color/index.js",
|
|
117
|
+
"import": "{ createConverter, srgb, oklch }",
|
|
118
|
+
"limit": "1.22 kB",
|
|
119
|
+
"gzip": true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "parse and convert between two spaces",
|
|
123
|
+
"path": "esm/color/index.js",
|
|
124
|
+
"import": "{ parse, createConverter, srgb, oklch }",
|
|
125
|
+
"limit": "4.85 kB",
|
|
126
|
+
"gzip": true
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "toHex over every space",
|
|
130
|
+
"path": "esm/color/index.js",
|
|
131
|
+
"import": "{ toHex }",
|
|
132
|
+
"limit": "3.01 kB",
|
|
133
|
+
"gzip": true
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "toHex from oklch, narrow",
|
|
137
|
+
"path": "esm/color/index.js",
|
|
138
|
+
"import": "{ createToHex, oklch }",
|
|
139
|
+
"limit": "1.31 kB",
|
|
140
|
+
"gzip": true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "toGamut over every space",
|
|
144
|
+
"path": "esm/color/index.js",
|
|
145
|
+
"import": "{ toGamut }",
|
|
146
|
+
"limit": "3.86 kB",
|
|
147
|
+
"gzip": true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "toGamut, narrow",
|
|
151
|
+
"path": "esm/color/index.js",
|
|
152
|
+
"import": "{ createToGamut }",
|
|
153
|
+
"limit": "2.19 kB",
|
|
154
|
+
"gzip": true
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "mix over every space",
|
|
158
|
+
"path": "esm/color/index.js",
|
|
159
|
+
"import": "{ mix }",
|
|
160
|
+
"limit": "7.18 kB",
|
|
161
|
+
"gzip": true
|
|
83
162
|
},
|
|
84
163
|
{
|
|
85
|
-
"
|
|
86
|
-
"
|
|
164
|
+
"name": "mix, narrow",
|
|
165
|
+
"path": "esm/color/index.js",
|
|
166
|
+
"import": "{ createMix }",
|
|
167
|
+
"limit": "1.57 kB",
|
|
168
|
+
"gzip": true
|
|
87
169
|
},
|
|
88
170
|
{
|
|
89
|
-
"
|
|
90
|
-
"
|
|
171
|
+
"name": "contrast helpers over every space",
|
|
172
|
+
"path": "esm/color/index.js",
|
|
173
|
+
"import": "{ contrast, meets, onColor, findContrast }",
|
|
174
|
+
"limit": "8.22 kB",
|
|
175
|
+
"gzip": true
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "contrast helpers, narrow",
|
|
179
|
+
"path": "esm/color/index.js",
|
|
180
|
+
"import": "{ createContrast, createMeets, createOnColor, createFindContrast }",
|
|
181
|
+
"limit": "2.96 kB",
|
|
182
|
+
"gzip": true
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "every converting helper over every space",
|
|
186
|
+
"path": "esm/color/index.js",
|
|
187
|
+
"import": "{ toHex, toGamut, inGamut, deltaEOk, equals, mix, contrast, meets, onColor, findContrast }",
|
|
188
|
+
"limit": "9.09 kB",
|
|
189
|
+
"gzip": true
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "every converting helper, narrow",
|
|
193
|
+
"path": "esm/color/index.js",
|
|
194
|
+
"import": "{ createToHex, createToGamut, createInGamut, createDeltaEOk, createEquals, createMix, createContrast, createMeets, createOnColor, createFindContrast }",
|
|
195
|
+
"limit": "3.89 kB",
|
|
196
|
+
"gzip": true
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "full color core",
|
|
200
|
+
"path": "esm/color/index.js",
|
|
201
|
+
"import": "{ parse, toCss, toHex, toGamut, inGamut, deltaEOk, equals, fromArgb, toArgb, convert, spaces }",
|
|
202
|
+
"limit": "8.21 kB",
|
|
203
|
+
"gzip": true
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"name": "core with mix",
|
|
207
|
+
"path": "esm/color/index.js",
|
|
208
|
+
"import": "{ parse, toCss, toGamut, mix }",
|
|
209
|
+
"limit": "8.5 kB",
|
|
210
|
+
"gzip": true
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "core with mix and contrast",
|
|
214
|
+
"path": "esm/color/index.js",
|
|
215
|
+
"import": "{ parse, toCss, toGamut, mix, contrast, meets, onColor, findContrast }",
|
|
216
|
+
"limit": "9.23 kB",
|
|
217
|
+
"gzip": true
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "scales",
|
|
221
|
+
"path": "esm/scale/index.js",
|
|
222
|
+
"import": "*",
|
|
223
|
+
"limit": "10.55 kB",
|
|
224
|
+
"gzip": true
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "palette",
|
|
228
|
+
"path": "esm/palette/index.js",
|
|
229
|
+
"import": "*",
|
|
230
|
+
"limit": "9.9 kB",
|
|
231
|
+
"gzip": true
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "tokens",
|
|
235
|
+
"path": "esm/tokens/index.js",
|
|
236
|
+
"import": "*",
|
|
237
|
+
"limit": "9.03 kB",
|
|
238
|
+
"gzip": true
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": "everything",
|
|
242
|
+
"path": "esm/color/index.js",
|
|
243
|
+
"import": "*",
|
|
244
|
+
"limit": "12.13 kB",
|
|
245
|
+
"gzip": true
|
|
91
246
|
}
|
|
92
|
-
]
|
|
93
|
-
|
|
247
|
+
],
|
|
248
|
+
"keywords": [
|
|
249
|
+
"agent",
|
|
250
|
+
"axi",
|
|
251
|
+
"cli",
|
|
252
|
+
"color",
|
|
253
|
+
"design-system",
|
|
254
|
+
"palette"
|
|
255
|
+
],
|
|
256
|
+
"bin": {
|
|
257
|
+
"color-map": "./bin/color-map.js"
|
|
258
|
+
},
|
|
259
|
+
"scripts": {
|
|
260
|
+
"build": "tsdown && node scripts/write-schemas.mjs",
|
|
261
|
+
"bench": "node scripts/bench.mjs",
|
|
262
|
+
"build:watch": "tsdown --watch",
|
|
263
|
+
"clean": "rimraf .reports bin cjs coverage dist esm",
|
|
264
|
+
"coverage": "vitest run --coverage",
|
|
265
|
+
"depcheck": "depcheck",
|
|
266
|
+
"llms": "node scripts/generate-llms-txt.mjs",
|
|
267
|
+
"llms:check": "node scripts/generate-llms-txt.mjs --check",
|
|
268
|
+
"nuke": "pnpm clean && rimraf node_modules",
|
|
269
|
+
"pack:check": "node scripts/check-pack.mjs && node scripts/sync-plugin-version.mjs --check",
|
|
270
|
+
"schemas": "node scripts/write-schemas.mjs",
|
|
271
|
+
"size": "size-limit",
|
|
272
|
+
"test": "vitest run",
|
|
273
|
+
"typecheck": "tsc",
|
|
274
|
+
"verify": "npm-run-all build -p depcheck typecheck coverage size llms:check pack:check",
|
|
275
|
+
"watch": "vitest"
|
|
276
|
+
}
|
|
277
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "color-map",
|
|
4
|
+
"version": "2.3.0",
|
|
5
|
+
"description": "Generate WCAG-checked color palettes, scales and design tokens with the color-map CLI",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Homa Wong (unional)"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/cyberuni/color-map",
|
|
10
|
+
"repository": "https://github.com/cyberuni/color-map",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": ["color", "palette", "design-system", "contrast", "css"],
|
|
13
|
+
"extensions": {
|
|
14
|
+
"org.cyberuni.universal-plugin": {
|
|
15
|
+
"vendors": ["claude-code", "cursor", "codex", "copilot-cli"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/color-map/schemas/contrast.schema.json",
|
|
4
|
+
"title": "color-map contrast",
|
|
5
|
+
"description": "WCAG 2 contrast ratio of a text color on a background, with the AA and AAA verdicts",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"fg": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The text (foreground) color",
|
|
11
|
+
"x-kind": "argument"
|
|
12
|
+
},
|
|
13
|
+
"bg": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The background color",
|
|
16
|
+
"x-kind": "argument"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"fg",
|
|
21
|
+
"bg"
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/color-map/schemas/convert.schema.json",
|
|
4
|
+
"title": "color-map convert",
|
|
5
|
+
"description": "Convert a CSS color to another color space",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"color": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "Any CSS color, such as \"#3b82f6\" or \"oklch(0.7 0.15 250)\"",
|
|
11
|
+
"x-kind": "argument"
|
|
12
|
+
},
|
|
13
|
+
"to": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": [
|
|
16
|
+
"srgb",
|
|
17
|
+
"srgb-linear",
|
|
18
|
+
"hsl",
|
|
19
|
+
"hwb",
|
|
20
|
+
"lab",
|
|
21
|
+
"lch",
|
|
22
|
+
"oklab",
|
|
23
|
+
"oklch",
|
|
24
|
+
"display-p3",
|
|
25
|
+
"display-p3-linear",
|
|
26
|
+
"a98-rgb",
|
|
27
|
+
"prophoto-rgb",
|
|
28
|
+
"rec2020",
|
|
29
|
+
"xyz-d50",
|
|
30
|
+
"xyz-d65"
|
|
31
|
+
],
|
|
32
|
+
"description": "Target color space",
|
|
33
|
+
"default": "srgb",
|
|
34
|
+
"x-kind": "option"
|
|
35
|
+
},
|
|
36
|
+
"gamut": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": [
|
|
39
|
+
"srgb",
|
|
40
|
+
"srgb-linear",
|
|
41
|
+
"display-p3",
|
|
42
|
+
"display-p3-linear",
|
|
43
|
+
"a98-rgb",
|
|
44
|
+
"prophoto-rgb",
|
|
45
|
+
"rec2020"
|
|
46
|
+
],
|
|
47
|
+
"description": "Map the result into this gamut (CSS gamut mapping) when it falls outside",
|
|
48
|
+
"x-kind": "option"
|
|
49
|
+
},
|
|
50
|
+
"full": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"description": "Show the complete output instead of truncating it",
|
|
53
|
+
"x-kind": "option"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": [
|
|
57
|
+
"color"
|
|
58
|
+
],
|
|
59
|
+
"additionalProperties": false
|
|
60
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/color-map/schemas/export.schema.json",
|
|
4
|
+
"title": "color-map export",
|
|
5
|
+
"description": "Write a palette, a scale or your own tokens as DTCG JSON, CSS variables or a Tailwind v4 theme",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"color": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The brand color to build tokens from; leave out with --tokens",
|
|
11
|
+
"x-kind": "argument"
|
|
12
|
+
},
|
|
13
|
+
"to": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"enum": [
|
|
16
|
+
"dtcg",
|
|
17
|
+
"css",
|
|
18
|
+
"tailwind"
|
|
19
|
+
],
|
|
20
|
+
"description": "Output format",
|
|
21
|
+
"default": "css",
|
|
22
|
+
"x-kind": "option"
|
|
23
|
+
},
|
|
24
|
+
"source": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": [
|
|
27
|
+
"palette",
|
|
28
|
+
"scale"
|
|
29
|
+
],
|
|
30
|
+
"description": "What to build from the color",
|
|
31
|
+
"default": "palette",
|
|
32
|
+
"x-kind": "option"
|
|
33
|
+
},
|
|
34
|
+
"mode": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"enum": [
|
|
37
|
+
"light",
|
|
38
|
+
"dark"
|
|
39
|
+
],
|
|
40
|
+
"description": "light or dark, for --source palette",
|
|
41
|
+
"default": "light",
|
|
42
|
+
"x-kind": "option"
|
|
43
|
+
},
|
|
44
|
+
"tokens": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "A JSON file of CSS color strings, nested as you like, instead of a color",
|
|
47
|
+
"x-kind": "option"
|
|
48
|
+
},
|
|
49
|
+
"space": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"enum": [
|
|
52
|
+
"srgb",
|
|
53
|
+
"srgb-linear",
|
|
54
|
+
"hsl",
|
|
55
|
+
"hwb",
|
|
56
|
+
"lab",
|
|
57
|
+
"lch",
|
|
58
|
+
"oklab",
|
|
59
|
+
"oklch",
|
|
60
|
+
"display-p3",
|
|
61
|
+
"display-p3-linear",
|
|
62
|
+
"a98-rgb",
|
|
63
|
+
"prophoto-rgb",
|
|
64
|
+
"rec2020",
|
|
65
|
+
"xyz-d50",
|
|
66
|
+
"xyz-d65"
|
|
67
|
+
],
|
|
68
|
+
"description": "Convert every color to this space (css, tailwind)",
|
|
69
|
+
"x-kind": "option"
|
|
70
|
+
},
|
|
71
|
+
"prefix": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Variable name prefix (css; tailwind uses --namespace)",
|
|
74
|
+
"x-kind": "option"
|
|
75
|
+
},
|
|
76
|
+
"selector": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "The CSS rule selector (css)",
|
|
79
|
+
"x-kind": "option"
|
|
80
|
+
},
|
|
81
|
+
"namespace": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "The Tailwind theme namespace (tailwind)",
|
|
84
|
+
"x-kind": "option"
|
|
85
|
+
},
|
|
86
|
+
"inline": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "Write @theme inline (tailwind)",
|
|
89
|
+
"x-kind": "option"
|
|
90
|
+
},
|
|
91
|
+
"precision": {
|
|
92
|
+
"type": "integer",
|
|
93
|
+
"minimum": 0,
|
|
94
|
+
"maximum": 10,
|
|
95
|
+
"description": "Decimal places in printed numbers",
|
|
96
|
+
"x-kind": "option"
|
|
97
|
+
},
|
|
98
|
+
"hex": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"description": "Add the hex fallback to DTCG values; --hex=false drops it",
|
|
101
|
+
"x-kind": "option"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"required": [],
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/color-map/schemas/find-contrast.schema.json",
|
|
4
|
+
"title": "color-map find-contrast",
|
|
5
|
+
"description": "Find the color closest in lightness to a background that reaches a WCAG 2 contrast target",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"bg": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The background color",
|
|
11
|
+
"x-kind": "argument"
|
|
12
|
+
},
|
|
13
|
+
"target": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"minimum": 1,
|
|
16
|
+
"maximum": 21,
|
|
17
|
+
"description": "The contrast ratio to reach, 1 to 21",
|
|
18
|
+
"default": 4.5,
|
|
19
|
+
"x-kind": "option"
|
|
20
|
+
},
|
|
21
|
+
"hue": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"description": "OKLCH hue of the result in degrees (default: the background's hue)",
|
|
24
|
+
"x-kind": "option"
|
|
25
|
+
},
|
|
26
|
+
"chroma": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"minimum": 0,
|
|
29
|
+
"description": "OKLCH chroma of the result (default 0, a gray)",
|
|
30
|
+
"x-kind": "option"
|
|
31
|
+
},
|
|
32
|
+
"direction": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": [
|
|
35
|
+
"lighter",
|
|
36
|
+
"darker"
|
|
37
|
+
],
|
|
38
|
+
"description": "Which way to look first",
|
|
39
|
+
"x-kind": "option"
|
|
40
|
+
},
|
|
41
|
+
"full": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Show the complete output instead of truncating it",
|
|
44
|
+
"x-kind": "option"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"bg"
|
|
49
|
+
],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|