@soybeanjs/colord 0.0.8 → 0.1.1

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
@@ -17,7 +17,8 @@
17
17
 
18
18
  ## Differences from [colord](https://github.com/omgovich/colord)
19
19
 
20
- - support `oklab` and `oklch` color space
20
+ - support `oklab` and `oklch` color models
21
+ - support `palette` API to generate and find the nearest palette color
21
22
  - more correct color parsing
22
23
  - simplify type definitions
23
24
  - rewrite color string parsing
@@ -38,6 +39,16 @@ colord("hsl(0, 50%, 50%)").darken(0.25).toHex(); // "#602020"
38
39
  colord({ r: 128, g: 128, b: 128, alpha: 0.25 }).toRgbString(); // "rgba(128, 128, 128, 0.25)"
39
40
  ```
40
41
 
42
+ ## Palette API
43
+
44
+ ```ts
45
+ import { tailwindPalette, generatePalette, generateNearestPalette } from '@soybeanjs/colord/palette';
46
+
47
+ tailwindPalette.slate['500']; // 'oklch(55.4% 0.046 257.417)'
48
+ generatePalette('red'); // generate the palette of the color 'red'
49
+ generateNearestPalette('red'); // find the nearest color in the palette of the color 'red'
50
+ ```
51
+
41
52
  ## Supported Color Models
42
53
 
43
54
  - Hexadecimal strings (including 3, 4 and 8 digit notations)
@@ -53,6 +64,7 @@ colord({ r: 128, g: 128, b: 128, alpha: 0.25 }).toRgbString(); // "rgba(128, 128
53
64
  - OKLAB objects ([via plugin](#plugins))
54
65
  - OKLCH objects ([via plugin](#plugins))
55
66
 
67
+
56
68
  ## More API
57
69
 
58
70
  see the more api in [colord](https://github.com/omgovich/colord)
@@ -1,4 +1,4 @@
1
- import { a as HsvColor, c as InputSource, i as HslColor, t as AnyColor, v as RgbColor } from "./types-B93dJkfp.js";
1
+ import { a as HsvColor, c as InputSource, i as HslColor, t as AnyColor, v as RgbColor } from "./types-CV5bTriG.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-DjohCNUk.js";
1
+ import { n as colord, t as Colord } from "./colord-iJvjkDaN.js";
2
2
  export { Colord, colord };
@@ -1,5 +1,5 @@
1
- import { _ as Parsers } from "./types-B93dJkfp.js";
2
- import { t as Colord } from "./colord-DjohCNUk.js";
1
+ import { _ as Parsers } from "./types-CV5bTriG.js";
2
+ import { t as Colord } from "./colord-iJvjkDaN.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 XyzColor, f as OklabColor, 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 } from "./types-B93dJkfp.js";
2
- import { n as colord, t as Colord } from "./colord-DjohCNUk.js";
3
- import { n as extend, t as Plugin } from "./extend-DmcZT4-q.js";
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-CV5bTriG.js";
2
+ import { n as colord, t as Colord } from "./colord-iJvjkDaN.js";
3
+ import { n as extend, t as Plugin } from "./extend-BwkxQVzY.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 Plugin, type RgbColor, 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 PaletteColorLevel, type Plugin, type RgbColor, type TailwindPaletteColorKey, type XyzColor, colord, extend, getFormat, random };
@@ -1,4 +1,4 @@
1
- import { d as NearestPalette, g as PaletteColorLevel, h as OutputFormat, m as OutputColorMap, t as AnyColor, y as TailwindPaletteColor } from "../types-B93dJkfp.js";
1
+ import { d as NearestPalette, g as PaletteColorLevel, h as OutputFormat, m as OutputColorMap, t as AnyColor, y as TailwindPaletteColor } from "../types-CV5bTriG.js";
2
2
 
3
3
  //#region src/palette/constant.d.ts
4
4
 
@@ -1,5 +1,5 @@
1
- import { t as AnyColor } from "../types-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { t as AnyColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { n as CmykColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-DmcZT4-q.js";
1
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { o as HwbColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { l as LabColor, t as AnyColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { u as LchColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-DmcZT4-q.js";
1
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { t as AnyColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.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-DmcZT4-q.js";
1
+ import { t as Plugin } from "../extend-BwkxQVzY.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-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { f as OklabColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.js";
3
3
 
4
4
  //#region src/plugins/oklab.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,5 +1,5 @@
1
- import { p as OklchColor } from "../types-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { p as OklchColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.js";
3
3
 
4
4
  //#region src/plugins/oklch.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -1,5 +1,5 @@
1
- import { b as XyzColor } from "../types-B93dJkfp.js";
2
- import { t as Plugin } from "../extend-DmcZT4-q.js";
1
+ import { x as XyzColor } from "../types-CV5bTriG.js";
2
+ import { t as Plugin } from "../extend-BwkxQVzY.js";
3
3
 
4
4
  //#region src/plugins/xyz.d.ts
5
5
  declare module '@soybeanjs/colord' {
@@ -109,4 +109,4 @@ interface NearestPalette<F extends OutputFormat> {
109
109
  palette: Record<PaletteColorLevel, OutputColorMap[F]>;
110
110
  }
111
111
  //#endregion
112
- export { Parsers as _, HsvColor as a, XyzColor 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, TailwindPaletteColor as y };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soybeanjs/colord",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.1.1",
5
5
  "description": "A tiny yet powerful tool for high-performance color manipulations and conversions",
6
6
  "author": {
7
7
  "name": "Soybean",