@soybeanjs/colord 0.0.3 → 0.0.4
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/dist/{colord-BV1k1-gC.js → colord-C3iU53g-.js} +5 -5
- package/dist/colord.js +8 -8
- package/dist/{get-BFaklfVd.js → get-D0jfz1WU.js} +1 -1
- package/dist/{hsv-UWMaaOSN.js → hsv-BKcGyyrD.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/{lab-CJHLdqfe.js → lab-B5wAd4fu.js} +2 -2
- package/dist/{manipulate-CeAgrUd6.js → manipulate-C3CvrU4m.js} +3 -3
- package/dist/plugins/a11y.js +3 -3
- package/dist/plugins/cmyk.js +1 -1
- package/dist/plugins/hwb.js +2 -2
- package/dist/plugins/lab.js +5 -5
- package/dist/plugins/lch.js +4 -4
- package/dist/plugins/minify.js +1 -1
- package/dist/plugins/mix.js +6 -6
- package/dist/plugins/oklab.js +4 -6
- package/dist/plugins/oklch.js +4 -6
- package/dist/plugins/xyz.js +3 -3
- package/dist/{rgb-CfVJB1Bj.js → rgb-DNYno5F7.js} +1 -1
- package/dist/{utils-BgIyY6bK.js → utils-DajWVr6Z.js} +11 -1
- package/dist/{xyz-MII3ndWO.js → xyz-CXEZJhV8.js} +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as parseRgbString, c as roundRgb, i as parseRgb, s as rgbToRgbString } from "./rgb-
|
|
3
|
-
import { i as roundHsv, n as parseHsv, r as rgbToHsv } from "./hsv-
|
|
4
|
-
import { a as saturate, c as rgbToHsl, l as rgbToHslString, n as invert, o as parseHsl, r as lighten, s as parseHslString, t as changeAlpha, u as roundHsl } from "./manipulate-
|
|
5
|
-
import { t as getBrightness } from "./get-
|
|
1
|
+
import { l as round, v as ALPHA_PRECISION } from "./utils-DajWVr6Z.js";
|
|
2
|
+
import { a as parseRgbString, c as roundRgb, i as parseRgb, s as rgbToRgbString } from "./rgb-DNYno5F7.js";
|
|
3
|
+
import { i as roundHsv, n as parseHsv, r as rgbToHsv } from "./hsv-BKcGyyrD.js";
|
|
4
|
+
import { a as saturate, c as rgbToHsl, l as rgbToHslString, n as invert, o as parseHsl, r as lighten, s as parseHslString, t as changeAlpha, u as roundHsl } from "./manipulate-C3CvrU4m.js";
|
|
5
|
+
import { t as getBrightness } from "./get-D0jfz1WU.js";
|
|
6
6
|
|
|
7
7
|
//#region src/models/hex.ts
|
|
8
8
|
const hexMatcher = /^#([0-9a-f]{3,8})$/i;
|
package/dist/colord.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./rgb-
|
|
3
|
-
import { n as colord, t as Colord } from "./colord-
|
|
4
|
-
import "./hsv-
|
|
5
|
-
import "./manipulate-
|
|
6
|
-
import "./xyz-
|
|
7
|
-
import "./lab-
|
|
8
|
-
import "./get-
|
|
1
|
+
import "./utils-DajWVr6Z.js";
|
|
2
|
+
import "./rgb-DNYno5F7.js";
|
|
3
|
+
import { n as colord, t as Colord } from "./colord-C3iU53g-.js";
|
|
4
|
+
import "./hsv-BKcGyyrD.js";
|
|
5
|
+
import "./manipulate-C3CvrU4m.js";
|
|
6
|
+
import "./xyz-CXEZJhV8.js";
|
|
7
|
+
import "./lab-B5wAd4fu.js";
|
|
8
|
+
import "./get-D0jfz1WU.js";
|
|
9
9
|
|
|
10
10
|
export { Colord, colord };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, t as clamp, v as ALPHA_PRECISION } from "./utils-DajWVr6Z.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/hsv.ts
|
|
4
4
|
const clampHsv = (hsv) => ({
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./rgb-
|
|
3
|
-
import { a as parsers, i as getFormat, n as colord, r as random, t as Colord } from "./colord-
|
|
4
|
-
import "./hsv-
|
|
5
|
-
import "./manipulate-
|
|
6
|
-
import "./xyz-
|
|
7
|
-
import "./lab-
|
|
8
|
-
import "./get-
|
|
1
|
+
import "./utils-DajWVr6Z.js";
|
|
2
|
+
import "./rgb-DNYno5F7.js";
|
|
3
|
+
import { a as parsers, i as getFormat, n as colord, r as random, t as Colord } from "./colord-C3iU53g-.js";
|
|
4
|
+
import "./hsv-BKcGyyrD.js";
|
|
5
|
+
import "./manipulate-C3CvrU4m.js";
|
|
6
|
+
import "./xyz-CXEZJhV8.js";
|
|
7
|
+
import "./lab-B5wAd4fu.js";
|
|
8
|
+
import "./get-D0jfz1WU.js";
|
|
9
9
|
|
|
10
10
|
//#region src/extend.ts
|
|
11
11
|
const activePlugins = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as xyzToRgb, n as rgbToXyz } from "./xyz-
|
|
1
|
+
import { a as mul3x3, d as M_D65_TO_D50, i as isPresent, l as round, o as parseAlpha, t as clamp, u as M_D50_TO_D65, v as ALPHA_PRECISION, y as D50 } from "./utils-DajWVr6Z.js";
|
|
2
|
+
import { i as xyzToRgb, n as rgbToXyz } from "./xyz-CXEZJhV8.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/lab.ts
|
|
5
5
|
const EPSILON = 216 / 24389;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as rgbToHsv, t as hsvToRgb } from "./hsv-
|
|
3
|
-
import { a as rgbToLab, n as labToRgb, t as clampLab } from "./lab-
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp, v as ALPHA_PRECISION } from "./utils-DajWVr6Z.js";
|
|
2
|
+
import { r as rgbToHsv, t as hsvToRgb } from "./hsv-BKcGyyrD.js";
|
|
3
|
+
import { a as rgbToLab, n as labToRgb, t as clampLab } from "./lab-B5wAd4fu.js";
|
|
4
4
|
|
|
5
5
|
//#region src/models/hsl.ts
|
|
6
6
|
const clampHsl = (hsl) => {
|
package/dist/plugins/a11y.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import { i as getLuminance, n as getContrast } from "../get-
|
|
1
|
+
import { l as round, r as floor } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import "../rgb-DNYno5F7.js";
|
|
3
|
+
import { i as getLuminance, n as getContrast } from "../get-D0jfz1WU.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/a11y.ts
|
|
6
6
|
/**
|
package/dist/plugins/cmyk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as isPresent, l as round, o as parseAlpha, t as clamp, v as ALPHA_PRECISION } from "../utils-DajWVr6Z.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/cmyk.ts
|
|
4
4
|
/**
|
package/dist/plugins/hwb.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as rgbToHsv, t as hsvToRgb } from "../hsv-
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp, v as ALPHA_PRECISION } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import { r as rgbToHsv, t as hsvToRgb } from "../hsv-BKcGyyrD.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/hwb.ts
|
|
5
5
|
const clampHwb = (hwb) => {
|
package/dist/plugins/lab.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import "../xyz-
|
|
4
|
-
import { a as rgbToLab, i as parseLabString, o as roundLab, r as parseLab } from "../lab-
|
|
5
|
-
import { r as getDeltaE2000 } from "../get-
|
|
1
|
+
import { l as round, t as clamp } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import "../rgb-DNYno5F7.js";
|
|
3
|
+
import "../xyz-CXEZJhV8.js";
|
|
4
|
+
import { a as rgbToLab, i as parseLabString, o as roundLab, r as parseLab } from "../lab-B5wAd4fu.js";
|
|
5
|
+
import { r as getDeltaE2000 } from "../get-D0jfz1WU.js";
|
|
6
6
|
|
|
7
7
|
//#region src/plugins/lab.ts
|
|
8
8
|
/**
|
package/dist/plugins/lch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import "../xyz-
|
|
4
|
-
import { a as rgbToLab, n as labToRgb } from "../lab-
|
|
1
|
+
import { i as isPresent, l as round, n as clampHue, o as parseAlpha, s as parseHue, t as clamp, v as ALPHA_PRECISION } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import "../rgb-DNYno5F7.js";
|
|
3
|
+
import "../xyz-CXEZJhV8.js";
|
|
4
|
+
import { a as rgbToLab, n as labToRgb } from "../lab-B5wAd4fu.js";
|
|
5
5
|
|
|
6
6
|
//#region src/models/lch.ts
|
|
7
7
|
/**
|
package/dist/plugins/minify.js
CHANGED
package/dist/plugins/mix.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import "../hsv-
|
|
4
|
-
import { i as mix } from "../manipulate-
|
|
5
|
-
import "../xyz-
|
|
6
|
-
import "../lab-
|
|
1
|
+
import "../utils-DajWVr6Z.js";
|
|
2
|
+
import "../rgb-DNYno5F7.js";
|
|
3
|
+
import "../hsv-BKcGyyrD.js";
|
|
4
|
+
import { i as mix } from "../manipulate-C3CvrU4m.js";
|
|
5
|
+
import "../xyz-CXEZJhV8.js";
|
|
6
|
+
import "../lab-B5wAd4fu.js";
|
|
7
7
|
|
|
8
8
|
//#region src/plugins/mix.ts
|
|
9
9
|
/**
|
package/dist/plugins/oklab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-
|
|
1
|
+
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, o as parseAlpha, t as clamp, v as ALPHA_PRECISION } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-DNYno5F7.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/oklab.ts
|
|
5
5
|
const clampOklab = (oklab) => {
|
|
@@ -73,11 +73,9 @@ const oklabMatcher = /^oklab\(\s*([+-]?[\d.]+)%?\s+([+-]?[\d.]+)\s+([+-]?[\d.]+)
|
|
|
73
73
|
const parseOklabString = (input) => {
|
|
74
74
|
const match = oklabMatcher.exec(input);
|
|
75
75
|
if (!match) return null;
|
|
76
|
-
const [_,
|
|
77
|
-
let l = Number.parseFloat(L);
|
|
78
|
-
if (L.endsWith("%")) l /= 100;
|
|
76
|
+
const [_, l, a, b, alpha] = match;
|
|
79
77
|
return oklabToRgb(clampOklab({
|
|
80
|
-
l,
|
|
78
|
+
l: parseValueToDecimal(l),
|
|
81
79
|
a: Number.parseFloat(a),
|
|
82
80
|
b: Number.parseFloat(b),
|
|
83
81
|
alpha: parseAlpha(alpha)
|
package/dist/plugins/oklch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-
|
|
1
|
+
import { _ as OKLAB_M2_INV, a as mul3x3, c as parseValueToDecimal, g as OKLAB_M2, h as OKLAB_M1_INV, i as isPresent, l as round, m as OKLAB_M1, n as clampHue, o as parseAlpha, s as parseHue, t as clamp, v as ALPHA_PRECISION } from "../utils-DajWVr6Z.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb, t as clampLinearRgb } from "../rgb-DNYno5F7.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/oklch.ts
|
|
5
5
|
const clampOklch = (oklch) => {
|
|
@@ -82,11 +82,9 @@ const oklchMatcher = /^oklch\(\s*([+-]?[\d.]+)%?\s+([+-]?[\d.]+)\s+([+-]?[\d.]+)
|
|
|
82
82
|
const parseOklchString = (input) => {
|
|
83
83
|
const match = oklchMatcher.exec(input);
|
|
84
84
|
if (!match) return null;
|
|
85
|
-
const [_,
|
|
86
|
-
let l = Number.parseFloat(L);
|
|
87
|
-
if (L.endsWith("%")) l /= 100;
|
|
85
|
+
const [_, l, c, h, unit, alpha] = match;
|
|
88
86
|
return oklchToRgb(clampOklch({
|
|
89
|
-
l,
|
|
87
|
+
l: parseValueToDecimal(l),
|
|
90
88
|
c: Number.parseFloat(c),
|
|
91
89
|
h: parseHue(h, unit),
|
|
92
90
|
alpha: parseAlpha(alpha)
|
package/dist/plugins/xyz.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../utils-
|
|
2
|
-
import "../rgb-
|
|
3
|
-
import { n as rgbToXyz, r as roundXyz, t as parseXyz } from "../xyz-
|
|
1
|
+
import "../utils-DajWVr6Z.js";
|
|
2
|
+
import "../rgb-DNYno5F7.js";
|
|
3
|
+
import { n as rgbToXyz, r as roundXyz, t as parseXyz } from "../xyz-CXEZJhV8.js";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/xyz.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as isPresent, l as round, o as parseAlpha, t as clamp, v as ALPHA_PRECISION } from "./utils-DajWVr6Z.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/rgb.ts
|
|
4
4
|
const clampRgb = (rgb) => {
|
|
@@ -224,6 +224,16 @@ function parseAlpha(alpha) {
|
|
|
224
224
|
if (alpha.endsWith("%")) value /= 100;
|
|
225
225
|
return value;
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* parse value to decimal
|
|
229
|
+
* @param value
|
|
230
|
+
* @returns the decimal value in [0, 1]
|
|
231
|
+
*/
|
|
232
|
+
function parseValueToDecimal(value) {
|
|
233
|
+
const num = Number.parseFloat(value);
|
|
234
|
+
if (value.endsWith("%") || num > 1) return clamp(num / 100);
|
|
235
|
+
return clamp(num);
|
|
236
|
+
}
|
|
227
237
|
|
|
228
238
|
//#endregion
|
|
229
|
-
export {
|
|
239
|
+
export { OKLAB_M2_INV as _, mul3x3 as a, parseValueToDecimal as c, M_D65_TO_D50 as d, M_SRGB_TO_XYZ_D65 as f, OKLAB_M2 as g, OKLAB_M1_INV as h, isPresent as i, round as l, OKLAB_M1 as m, clampHue as n, parseAlpha as o, M_XYZ_D65_TO_SRGB as p, floor as r, parseHue as s, clamp as t, M_D50_TO_D65 as u, ALPHA_PRECISION as v, D50 as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-
|
|
1
|
+
import { a as mul3x3, f as M_SRGB_TO_XYZ_D65, i as isPresent, l as round, p as M_XYZ_D65_TO_SRGB, t as clamp, v as ALPHA_PRECISION, y as D50 } from "./utils-DajWVr6Z.js";
|
|
2
|
+
import { n as clampRgb, o as rgbToLinearRgb, r as linearRgbToRgb } from "./rgb-DNYno5F7.js";
|
|
3
3
|
|
|
4
4
|
//#region src/models/xyz.ts
|
|
5
5
|
/**
|