@soybeanjs/colord 0.2.0 → 0.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/README.md CHANGED
@@ -56,6 +56,7 @@ generateNearestPalette('red'); // find the nearest color in the palette of the c
56
56
  - RGB strings and objects
57
57
  - HSL strings and objects
58
58
  - HSV objects
59
+ - OKLCH objects and strings
59
60
  - Color names ([via plugin](#plugins))
60
61
  - HWB objects and strings ([via plugin](#plugins))
61
62
  - CMYK objects and strings ([via plugin](#plugins))
@@ -1,4 +1,4 @@
1
- import { a as HsvColor, c as InputSource, i as HslColor, p as OklchColor, t as AnyColor, v as RgbColor } from "./types-BP0NSyqd.js";
1
+ import { a as HsvColor, c as InputSource, f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "./types-IZeCCEPk.js";
2
2
 
3
3
  //#region src/colord.d.ts
4
4
 
package/dist/colord.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as colord, t as Colord } from "./colord-AfN0aSRY.js";
1
+ import { n as colord, t as Colord } from "./colord-5yx_wwuH.js";
2
2
  export { Colord, colord };
@@ -1,5 +1,5 @@
1
- import { _ as Parsers } from "./types-BP0NSyqd.js";
2
- import { t as Colord } from "./colord-AfN0aSRY.js";
1
+ import { p as Parsers } from "./types-IZeCCEPk.js";
2
+ import { t as Colord } from "./colord-5yx_wwuH.js";
3
3
 
4
4
  //#region src/extend.d.ts
5
5
  type Plugin = (ColordClass: typeof Colord, parsers: Parsers) => void;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as HsvColor, b as TailwindPaletteColorKey, f as OklabColor, g as PaletteColorLevel, i as HslColor, l as LabColor, o as HwbColor, p as OklchColor, r as Format, s as Input, t as AnyColor, u as LchColor, v as RgbColor, x as XyzColor } from "./types-BP0NSyqd.js";
2
- import { n as colord, t as Colord } from "./colord-AfN0aSRY.js";
3
- import { n as extend, t as Plugin } from "./extend-UYBGWCHH.js";
1
+ import { a as HsvColor, d as OklabColor, f as OklchColor, h as XyzColor, i as HslColor, l as LabColor, m as RgbColor, o as HwbColor, r as Format, s as Input, t as AnyColor, u as LchColor } from "./types-IZeCCEPk.js";
2
+ import { n as colord, t as Colord } from "./colord-5yx_wwuH.js";
3
+ import { n as extend, t as Plugin } from "./extend-DD8Dqi45.js";
4
4
 
5
5
  //#region src/shared/parse.d.ts
6
6
 
@@ -12,4 +12,4 @@ declare const getFormat: (input: Input) => Format | undefined;
12
12
  //#region src/shared/random.d.ts
13
13
  declare const random: () => Colord;
14
14
  //#endregion
15
- export { type AnyColor, Colord, type HslColor, type HsvColor, type HwbColor, type LabColor, type LchColor, type OklabColor, type OklchColor, type PaletteColorLevel, type Plugin, type RgbColor, type TailwindPaletteColorKey, type XyzColor, colord, extend, getFormat, random };
15
+ export { type AnyColor, Colord, type HslColor, type HsvColor, type HwbColor, type LabColor, type LchColor, type OklabColor, type OklchColor, type Plugin, type RgbColor, type XyzColor, colord, extend, getFormat, random };
@@ -1,19 +1,59 @@
1
- import { d as NearestPalette, g as PaletteColorLevel, h as OutputFormat, m as OutputColorMap, t as AnyColor, y as TailwindPaletteColor } from "../types-BP0NSyqd.js";
1
+ import { f as OklchColor, i as HslColor, m as RgbColor, t as AnyColor } from "../types-IZeCCEPk.js";
2
2
 
3
- //#region src/palette/constant.d.ts
3
+ //#region src/palette/types.d.ts
4
4
 
5
+ /**
6
+ * the palette color level
7
+ *
8
+ * the main color level is 500
9
+ */
10
+ type PaletteColorLevel = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
11
+ type TailwindPaletteKey = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
12
+ type TailwindPaletteLevelColorKey = `${TailwindPaletteKey}.${PaletteColorLevel}`;
13
+ /**
14
+ * the tailwind palette
15
+ *
16
+ * the color format is `oklch` string
17
+ */
18
+ type TailwindPalette = { [K in TailwindPaletteKey]: { [L in PaletteColorLevel]: string } };
19
+ type OutputColorMap = {
20
+ hex: string;
21
+ rgb: RgbColor;
22
+ rgbString: string;
23
+ oklch: OklchColor;
24
+ oklchString: string;
25
+ hsl: HslColor;
26
+ hslString: string;
27
+ };
28
+ type OutputFormat = keyof OutputColorMap;
29
+ interface NearestPalette<F extends OutputFormat> {
30
+ /** current color */
31
+ current: OutputColorMap[F];
32
+ /** palette color key */
33
+ paletteKey: TailwindPaletteKey;
34
+ /** palette level */
35
+ level: PaletteColorLevel;
36
+ /** palette color */
37
+ color: OutputColorMap[F];
38
+ /** the color delta value */
39
+ delta: number;
40
+ /** palette colors */
41
+ palette: Record<PaletteColorLevel, OutputColorMap[F]>;
42
+ }
43
+ //#endregion
44
+ //#region src/palette/constant.d.ts
5
45
  /**
6
46
  * TailwindCSS v4 official oklch palette data
7
47
  *
8
48
  * the format is `oklch` string, like `oklch(98.4% 0.003 247.858)`
9
49
  */
10
- declare const tailwindPalette: TailwindPaletteColor;
50
+ declare const tailwindPalette: TailwindPalette;
11
51
  /**
12
52
  * TailwindCSS v4 official hsl palette data
13
53
  *
14
54
  * the format is `hsl` string, but no `hsl()` like `210.003, 34.547%, 98.004%`
15
55
  */
16
- declare const tailwindPaletteHsl: TailwindPaletteColor;
56
+ declare const tailwindPaletteHsl: TailwindPalette;
17
57
  //#endregion
18
58
  //#region src/palette/generate.d.ts
19
59
  /**
@@ -33,4 +73,4 @@ declare function generatePalette<F extends OutputFormat>(input: AnyColor, format
33
73
  */
34
74
  declare function generateNearestPalette<F extends OutputFormat>(input: AnyColor, format?: F): NearestPalette<F>;
35
75
  //#endregion
36
- export { generateNearestPalette, generatePalette, tailwindPalette, tailwindPaletteHsl };
76
+ export { type PaletteColorLevel, type TailwindPaletteLevelColorKey, generateNearestPalette, generatePalette, tailwindPalette, tailwindPaletteHsl };
@@ -1,5 +1,5 @@
1
- import { t as AnyColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { t as AnyColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/a11y.d.ts
5
5
  interface ReadabilityOptions {
@@ -1,5 +1,5 @@
1
- import { n as CmykColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { n as CmykColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/cmyk.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,4 +1,4 @@
1
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
2
2
 
3
3
  //#region src/plugins/harmonies.d.ts
4
4
  type HarmonyType = 'analogous' | 'complementary' | 'double-split-complementary' | 'rectangle' | 'split-complementary' | 'tetradic' | 'triadic';
@@ -1,5 +1,5 @@
1
- import { o as HwbColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { o as HwbColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/hwb.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,5 +1,5 @@
1
- import { l as LabColor, t as AnyColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { l as LabColor, t as AnyColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/lab.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,5 +1,5 @@
1
- import { u as LchColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { u as LchColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/lch.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,4 +1,4 @@
1
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
2
2
 
3
3
  //#region src/plugins/minify.d.ts
4
4
  interface MinificationOptions {
@@ -1,5 +1,5 @@
1
- import { t as AnyColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { t as AnyColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/mix.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,4 +1,4 @@
1
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
2
2
 
3
3
  //#region src/plugins/names.d.ts
4
4
  interface ConvertOptions {
@@ -1,5 +1,5 @@
1
- import { f as OklabColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { d as OklabColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/oklab.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,5 +1,5 @@
1
- import { x as XyzColor } from "../types-BP0NSyqd.js";
2
- import { t as Plugin } from "../extend-UYBGWCHH.js";
1
+ import { h as XyzColor } from "../types-IZeCCEPk.js";
2
+ import { t as Plugin } from "../extend-DD8Dqi45.js";
3
3
 
4
4
  //#region src/plugins/xyz.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -71,42 +71,5 @@ type Parsers = {
71
71
  string: Array<Parser<string>>;
72
72
  object: Array<Parser<InputObject>>;
73
73
  };
74
- /**
75
- * the palette color level
76
- *
77
- * the main color level is 500
78
- */
79
- type PaletteColorLevel = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
80
- type TailwindPaletteColorKey = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
81
- /**
82
- * the tailwind palette color
83
- *
84
- * the color format is `oklch` string
85
- */
86
- type TailwindPaletteColor = { [K in TailwindPaletteColorKey]: { [L in PaletteColorLevel]: string } };
87
- type OutputColorMap = {
88
- hex: string;
89
- rgb: RgbColor;
90
- rgbString: string;
91
- oklch: OklchColor;
92
- oklchString: string;
93
- hsl: HslColor;
94
- hslString: string;
95
- };
96
- type OutputFormat = keyof OutputColorMap;
97
- interface NearestPalette<F extends OutputFormat> {
98
- /** current color */
99
- current: OutputColorMap[F];
100
- /** palette color key */
101
- paletteKey: TailwindPaletteColorKey;
102
- /** palette level */
103
- level: PaletteColorLevel;
104
- /** palette color */
105
- color: OutputColorMap[F];
106
- /** the color delta value */
107
- delta: number;
108
- /** palette colors */
109
- palette: Record<PaletteColorLevel, OutputColorMap[F]>;
110
- }
111
74
  //#endregion
112
- export { Parsers as _, HsvColor as a, TailwindPaletteColorKey as b, InputSource as c, NearestPalette as d, OklabColor as f, PaletteColorLevel as g, OutputFormat as h, HslColor as i, LabColor as l, OutputColorMap as m, CmykColor as n, HwbColor as o, OklchColor as p, Format as r, Input as s, AnyColor as t, LchColor as u, RgbColor as v, XyzColor as x, TailwindPaletteColor as y };
75
+ export { HsvColor as a, InputSource as c, OklabColor as d, OklchColor as f, XyzColor as h, HslColor as i, LabColor as l, RgbColor as m, CmykColor as n, HwbColor as o, Parsers as p, Format as r, Input as s, AnyColor as t, LchColor as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soybeanjs/colord",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "A tiny yet powerful tool for high-performance color manipulations and conversions",
6
6
  "author": {
7
7
  "name": "Soybean",