@thi.ng/color 5.2.9 → 5.2.10
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/CHANGELOG.md +185 -185
- package/package.json +19 -19
- package/dev/hsluv.js +0 -224
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-
|
|
3
|
+
- **Last updated**: 2022-11-23T22:46:54Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -33,6 +33,17 @@ and/or version bumps of transitive dependencies.
|
|
|
33
33
|
|
|
34
34
|
#### 🚀 Features
|
|
35
35
|
|
|
36
|
+
- update ChannelSpec and hue-based modes ([01d93dc](https://github.com/thi-ng/umbrella/commit/01d93dc))
|
|
37
|
+
- add `hue` flag for channel spec
|
|
38
|
+
- update `.clamp()` impl to wrap hue in [0..1] interval
|
|
39
|
+
- add/update LCH conversion paths
|
|
40
|
+
- add/update color ops ([33cb4a1](https://github.com/thi-ng/umbrella/commit/33cb4a1))
|
|
41
|
+
- add `invert()`, `isRgbGamut()`, `lighten()`, `rotate()` ops
|
|
42
|
+
- add `tint()`, `tone()`, `shade()` ops
|
|
43
|
+
- update impls for `isBlack/Gray/White()`
|
|
44
|
+
- add/re-use internal multimethod dispatch fns
|
|
45
|
+
- add max chroma LCH fns ([ab4e67a](https://github.com/thi-ng/umbrella/commit/ab4e67a))
|
|
46
|
+
- add variations() generator ([91d760f](https://github.com/thi-ng/umbrella/commit/91d760f))
|
|
36
47
|
- add color theme strategies ([22057e5](https://github.com/thi-ng/umbrella/commit/22057e5))
|
|
37
48
|
- add strategy fns:
|
|
38
49
|
- `complementaryStrategy()`
|
|
@@ -41,17 +52,6 @@ and/or version bumps of transitive dependencies.
|
|
|
41
52
|
- `triadicStrategy()`
|
|
42
53
|
- `tetradicStrategy()`
|
|
43
54
|
- `squareStrategy()`
|
|
44
|
-
- add variations() generator ([91d760f](https://github.com/thi-ng/umbrella/commit/91d760f))
|
|
45
|
-
- add max chroma LCH fns ([ab4e67a](https://github.com/thi-ng/umbrella/commit/ab4e67a))
|
|
46
|
-
- add/update color ops ([33cb4a1](https://github.com/thi-ng/umbrella/commit/33cb4a1))
|
|
47
|
-
- add `invert()`, `isRgbGamut()`, `lighten()`, `rotate()` ops
|
|
48
|
-
- add `tint()`, `tone()`, `shade()` ops
|
|
49
|
-
- update impls for `isBlack/Gray/White()`
|
|
50
|
-
- add/re-use internal multimethod dispatch fns
|
|
51
|
-
- update ChannelSpec and hue-based modes ([01d93dc](https://github.com/thi-ng/umbrella/commit/01d93dc))
|
|
52
|
-
- add `hue` flag for channel spec
|
|
53
|
-
- update `.clamp()` impl to wrap hue in [0..1] interval
|
|
54
|
-
- add/update LCH conversion paths
|
|
55
55
|
|
|
56
56
|
## [4.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@4.1.0) (2021-11-17)
|
|
57
57
|
|
|
@@ -82,9 +82,9 @@ and/or version bumps of transitive dependencies.
|
|
|
82
82
|
|
|
83
83
|
#### ♻️ Refactoring
|
|
84
84
|
|
|
85
|
-
- update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
|
|
86
85
|
- update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
|
|
87
86
|
- add .js suffix for all relative imports
|
|
87
|
+
- update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
|
|
88
88
|
|
|
89
89
|
# [4.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@4.0.0) (2021-10-12)
|
|
90
90
|
|
|
@@ -105,6 +105,11 @@ and/or version bumps of transitive dependencies.
|
|
|
105
105
|
|
|
106
106
|
#### 🚀 Features
|
|
107
107
|
|
|
108
|
+
- add mandatory toRgb conversions ([6c4c13b](https://github.com/thi-ng/umbrella/commit/6c4c13b))
|
|
109
|
+
- due to defColor() dynamically registering related conversions for
|
|
110
|
+
a given color mode, deep imports might not make conversion routes
|
|
111
|
+
available
|
|
112
|
+
- new mandatory `toRgb` key in ColorSpec offers a fallback solution
|
|
108
113
|
- Int32/ABGR/ARGB updates/fixes ([d20e77c](https://github.com/thi-ng/umbrella/commit/d20e77c))
|
|
109
114
|
- update TypedColor (add IEqualsDelta, Iterable parents)
|
|
110
115
|
- add shared Int32.eqDelta() impl
|
|
@@ -113,31 +118,26 @@ and/or version bumps of transitive dependencies.
|
|
|
113
118
|
- return correct type if no args given
|
|
114
119
|
- update return type in .mapBuffer()
|
|
115
120
|
- add internal __scale8bit() helper fn
|
|
116
|
-
- add mandatory toRgb conversions ([6c4c13b](https://github.com/thi-ng/umbrella/commit/6c4c13b))
|
|
117
|
-
- due to defColor() dynamically registering related conversions for
|
|
118
|
-
a given color mode, deep imports might not make conversion routes
|
|
119
|
-
available
|
|
120
|
-
- new mandatory `toRgb` key in ColorSpec offers a fallback solution
|
|
121
121
|
|
|
122
122
|
#### ♻️ Refactoring
|
|
123
123
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
-
|
|
124
|
+
- update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
|
|
125
|
+
- update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
|
|
126
|
+
- update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
|
|
127
|
+
- update imports ([1736278](https://github.com/thi-ng/umbrella/commit/1736278))
|
|
128
|
+
- update imports ([00188f4](https://github.com/thi-ng/umbrella/commit/00188f4))
|
|
129
|
+
- update imports ([c642082](https://github.com/thi-ng/umbrella/commit/c642082))
|
|
130
|
+
- update imports (transducers) ([0bc002c](https://github.com/thi-ng/umbrella/commit/0bc002c))
|
|
128
131
|
- update deps & imports in various pkgs ([e1cf29e](https://github.com/thi-ng/umbrella/commit/e1cf29e))
|
|
129
132
|
- largely related to recent updates/restructuring of these packages:
|
|
130
133
|
- api
|
|
131
134
|
- defmulti
|
|
132
135
|
- errors
|
|
133
136
|
- logger
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
- update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
|
|
139
|
-
- update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
|
|
140
|
-
- update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
|
|
137
|
+
- sideeffect-free defmulti specs ([9909909](https://github.com/thi-ng/umbrella/commit/9909909))
|
|
138
|
+
- restructure package ([bf9edcb](https://github.com/thi-ng/umbrella/commit/bf9edcb))
|
|
139
|
+
- migrate/lift `/src/ops` source files to `/src` for easier use
|
|
140
|
+
- rename/migrate internal fns ([5faa747](https://github.com/thi-ng/umbrella/commit/5faa747))
|
|
141
141
|
|
|
142
142
|
## [3.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@3.2.0) (2021-08-04)
|
|
143
143
|
|
|
@@ -170,25 +170,23 @@ and/or version bumps of transitive dependencies.
|
|
|
170
170
|
|
|
171
171
|
#### 🛑 Breaking changes
|
|
172
172
|
|
|
173
|
-
-
|
|
174
|
-
- BREAKING CHANGE:
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
|
|
183
|
-
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
|
|
189
|
-
-
|
|
190
|
-
- replace convert() w/ new simplified version
|
|
191
|
-
- add/update generic isGray(), isBlack(), isWhite(), luminance()
|
|
173
|
+
- new parseCSS(), add SRGBA, update conversions ([f748d65](https://github.com/thi-ng/umbrella/commit/f748d65))
|
|
174
|
+
- BREAKING CHANGE: parseCSS() now returns wrapped color types,
|
|
175
|
+
not raw RGBA arrays as previously
|
|
176
|
+
- parseCSS() now returns SRGBA, HSLA, LAB or LCH color types and supports more CSS syntax opts
|
|
177
|
+
- all asXXX() functions also return wrapped colors,
|
|
178
|
+
only asCSS() still returns strings
|
|
179
|
+
- add SRGBA type/color mode reserve existing RGBA for
|
|
180
|
+
linear colors (non-gamma corrected)
|
|
181
|
+
- rename existing conversions, now using SRGBA (i.e. srgbaCss(),
|
|
182
|
+
srgbaInt()), add new versions for (now linear) RGBA
|
|
183
|
+
- parseCSS() RGB colors now result in SRGB instances,
|
|
184
|
+
use asRGBA() or srgbRgba() to convert to linear RGB
|
|
185
|
+
- add multiColorGradient(), update cos version ([dc88f37](https://github.com/thi-ng/umbrella/commit/dc88f37))
|
|
186
|
+
- BREAKING CHANGE: multiCosineGradient() args now given as options object
|
|
187
|
+
- add MultiGradientOpts
|
|
188
|
+
- add support for per-interval easing
|
|
189
|
+
- add support for result color coercion
|
|
192
190
|
- major update/rename all types/conversions ([4143c8f](https://github.com/thi-ng/umbrella/commit/4143c8f))
|
|
193
191
|
- BREAKING CHANGE: update/rename all color types/conversions
|
|
194
192
|
- rename YCbCrA => YCC
|
|
@@ -209,68 +207,59 @@ and/or version bumps of transitive dependencies.
|
|
|
209
207
|
- rename RANGES => COLOR_RANGES
|
|
210
208
|
- update colorFromRange(), colorsFromRange() and
|
|
211
209
|
colorsFromTheme() to return wrapped HSV colors
|
|
212
|
-
-
|
|
213
|
-
- BREAKING CHANGE:
|
|
214
|
-
- add
|
|
215
|
-
- add
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
-
|
|
228
|
-
|
|
210
|
+
- major restructure, new types/conversions ([6389f7c](https://github.com/thi-ng/umbrella/commit/6389f7c))
|
|
211
|
+
- BREAKING CHANGE: replace color classes w/ dynamically generated impls
|
|
212
|
+
- add ColorSpec, ColorType, ColorFactory types
|
|
213
|
+
- add defColor() color type factory based on declarative ColorSpec
|
|
214
|
+
- all color types now based on defColor()
|
|
215
|
+
- remove obsolete AColor class
|
|
216
|
+
- color factories now also act as converters
|
|
217
|
+
- add color() factory to wrap color in class for given mode
|
|
218
|
+
- remove CSS and Int types (use plain strings/ints now, and use css()
|
|
219
|
+
or resolveAsCss() to convert to CSS strings)
|
|
220
|
+
- parseCss() now returns ParsedColor (circumvents circular deps)
|
|
221
|
+
- replace convert() w/ new simplified version
|
|
222
|
+
- add/update generic isGray(), isBlack(), isWhite(), luminance()
|
|
223
|
+
- update types, CSS formatting ([f0502a2](https://github.com/thi-ng/umbrella/commit/f0502a2))
|
|
224
|
+
- BREAKING CHANGE: remove obsolete resolveAsCss(), use css() instead
|
|
225
|
+
- update MaybeColor alias
|
|
226
|
+
- update TypedColor
|
|
227
|
+
- merge resolveAsCss() cases into css()
|
|
228
|
+
- fix color factory for int args
|
|
229
229
|
|
|
230
230
|
#### 🚀 Features
|
|
231
231
|
|
|
232
|
-
-
|
|
233
|
-
|
|
234
|
-
- add/
|
|
235
|
-
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
-
|
|
240
|
-
- add
|
|
241
|
-
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
|
|
247
|
-
- add
|
|
248
|
-
-
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
- add
|
|
252
|
-
-
|
|
253
|
-
|
|
254
|
-
-
|
|
255
|
-
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- add
|
|
259
|
-
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
- add ARGB32/ABGR32 int types/conversions ([1993beb](https://github.com/thi-ng/umbrella/commit/1993beb))
|
|
264
|
-
- rename existing int conversion fns
|
|
265
|
-
- add versions for ARGB/ABGR orders
|
|
266
|
-
- add/update luminance fns
|
|
267
|
-
- minor update defConversions()
|
|
268
|
-
- add sortMapped() for mapped memory cols ([9a548ec](https://github.com/thi-ng/umbrella/commit/9a548ec))
|
|
269
|
-
- add lab D50/65 conv, update HSx<>CSS conv ([014e41d](https://github.com/thi-ng/umbrella/commit/014e41d))
|
|
270
|
-
- add labLabD50_65/D65_50()
|
|
271
|
-
- add lab65 -> CSS conversion (always as D50)
|
|
272
|
-
- since there's no official requirement, allow direct conversions
|
|
273
|
-
from sRGB to various HSx modes (also to be backward compatible)
|
|
232
|
+
- add Oklab color space support ([57a5bad](https://github.com/thi-ng/umbrella/commit/57a5bad))
|
|
233
|
+
- add XYZ/Oklab conversions, update/fix XYZ matrices ([e07a038](https://github.com/thi-ng/umbrella/commit/e07a038))
|
|
234
|
+
- add/refactor oklab conversions (XYZ / RGBA / CSS)
|
|
235
|
+
- RGB_XYZ / XYZ_RGB matrices were row-major, now correctly column major
|
|
236
|
+
- add barebones support for LAB & LCH ([6e3b8c9](https://github.com/thi-ng/umbrella/commit/6e3b8c9))
|
|
237
|
+
- update CSS_NAMES ([7ea0cf0](https://github.com/thi-ng/umbrella/commit/7ea0cf0))
|
|
238
|
+
- add SystemColors and defaults ([16bad21](https://github.com/thi-ng/umbrella/commit/16bad21))
|
|
239
|
+
- add wavelengthXyza() ([d29ce23](https://github.com/thi-ng/umbrella/commit/d29ce23))
|
|
240
|
+
- add AColor.toJSON() ([ee96412](https://github.com/thi-ng/umbrella/commit/ee96412))
|
|
241
|
+
- better handling for memory mapped colors
|
|
242
|
+
- add AColor.set() ([7e7a05c](https://github.com/thi-ng/umbrella/commit/7e7a05c))
|
|
243
|
+
- add XYY mode ([7a743f2](https://github.com/thi-ng/umbrella/commit/7a743f2))
|
|
244
|
+
- currently only conversions from/to XYZ
|
|
245
|
+
- add rgbSrgbApprox() and vice versa ([c1efada](https://github.com/thi-ng/umbrella/commit/c1efada))
|
|
246
|
+
- add/update Lab/XYZ/LCH conversions ([9feb251](https://github.com/thi-ng/umbrella/commit/9feb251))
|
|
247
|
+
- add D50/D65 white points & matrices
|
|
248
|
+
- add Lab<>XYZ<>RGB conversions (for diff white points)
|
|
249
|
+
- update/fix Lab/LCH CSS formatting
|
|
250
|
+
- update mulV33 to NOT clamp result by default
|
|
251
|
+
- add/update luminance & YCC conversion ([89ca131](https://github.com/thi-ng/umbrella/commit/89ca131))
|
|
252
|
+
- add SRGB luminance versions, update RGB version to
|
|
253
|
+
use linear weights
|
|
254
|
+
- update RGB<>YCC conversion fns (configurable luma)
|
|
255
|
+
- update grayscale(), luminanceAlpha() default coeffs
|
|
256
|
+
to use linear RGB weights
|
|
257
|
+
- update/restructure types, add buffer mapping ([cebaafa](https://github.com/thi-ng/umbrella/commit/cebaafa))
|
|
258
|
+
- add ColorFactory.mapBuffer()
|
|
259
|
+
- add ColorFactory/TypedColor.random()
|
|
260
|
+
- update all color class declarations
|
|
261
|
+
- split api.ts into /api subdir
|
|
262
|
+
- update css()
|
|
274
263
|
- split Lab & XYZ types into D50/D65 ([29e1e74](https://github.com/thi-ng/umbrella/commit/29e1e74))
|
|
275
264
|
- add LabD50/D65, add XYZD50/XYZD65
|
|
276
265
|
- rename factory fns (labD50/D65, xyzD50/D65)
|
|
@@ -278,53 +267,64 @@ and/or version bumps of transitive dependencies.
|
|
|
278
267
|
- add tools/limits.ts to sample RGB gamut limits, add to color defs
|
|
279
268
|
- add TypedColor.clamp(), update defColor()
|
|
280
269
|
- fix Oklab<>XYZ conversions (use D65 as default)
|
|
281
|
-
-
|
|
282
|
-
- add
|
|
283
|
-
- add
|
|
284
|
-
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
- add/
|
|
288
|
-
-
|
|
289
|
-
|
|
290
|
-
- update
|
|
291
|
-
- update
|
|
292
|
-
|
|
293
|
-
- add
|
|
294
|
-
- add
|
|
295
|
-
- add
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
- add
|
|
299
|
-
- add
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
|
|
304
|
-
- add
|
|
305
|
-
-
|
|
306
|
-
-
|
|
307
|
-
- add
|
|
308
|
-
-
|
|
309
|
-
-
|
|
310
|
-
|
|
311
|
-
- add
|
|
270
|
+
- add lab D50/65 conv, update HSx<>CSS conv ([014e41d](https://github.com/thi-ng/umbrella/commit/014e41d))
|
|
271
|
+
- add labLabD50_65/D65_50()
|
|
272
|
+
- add lab65 -> CSS conversion (always as D50)
|
|
273
|
+
- since there's no official requirement, allow direct conversions
|
|
274
|
+
from sRGB to various HSx modes (also to be backward compatible)
|
|
275
|
+
- add sortMapped() for mapped memory cols ([9a548ec](https://github.com/thi-ng/umbrella/commit/9a548ec))
|
|
276
|
+
- add ARGB32/ABGR32 int types/conversions ([1993beb](https://github.com/thi-ng/umbrella/commit/1993beb))
|
|
277
|
+
- rename existing int conversion fns
|
|
278
|
+
- add versions for ARGB/ABGR orders
|
|
279
|
+
- add/update luminance fns
|
|
280
|
+
- minor update defConversions()
|
|
281
|
+
- improve int ARGB/ABGR support ([6460e4d](https://github.com/thi-ng/umbrella/commit/6460e4d))
|
|
282
|
+
- add CSS conversions
|
|
283
|
+
- add ARGB<>ABGR swapping
|
|
284
|
+
- add converters for RGB/SRGB
|
|
285
|
+
- add setPrecision(), LCH cleanup ([778f84a](https://github.com/thi-ng/umbrella/commit/778f84a))
|
|
286
|
+
- add gradient and mix fns ([f31966c](https://github.com/thi-ng/umbrella/commit/f31966c))
|
|
287
|
+
- add cosineGradientBuffer()
|
|
288
|
+
- add multiColorGradientBuffer()
|
|
289
|
+
- add defMix(), mixHsl(), mixLch() fns
|
|
290
|
+
- remove obsolete mixAlpha() (use porter-duff pkg for alpha blending)
|
|
291
|
+
- convert mix() to defmulti, color mode aware ([faed98b](https://github.com/thi-ng/umbrella/commit/faed98b))
|
|
292
|
+
- add TypedColor/ColorFactory.range impls ([7ecfa0c](https://github.com/thi-ng/umbrella/commit/7ecfa0c))
|
|
293
|
+
- add Int32.alpha accessor, minor update int->srgb ([b65f9ee](https://github.com/thi-ng/umbrella/commit/b65f9ee))
|
|
294
|
+
- use RGB fallbacks for Lab/LCH CSS ([53ddaeb](https://github.com/thi-ng/umbrella/commit/53ddaeb))
|
|
295
|
+
- keep existing conversions, but disable until browser support is ready
|
|
296
|
+
- add generic analog() (for all color types) ([117a5bc](https://github.com/thi-ng/umbrella/commit/117a5bc))
|
|
297
|
+
- generic isBlack/Gray/White, LCH color ranges ([598afdf](https://github.com/thi-ng/umbrella/commit/598afdf))
|
|
298
|
+
- update ColorRange, ColorRangeOpts and related fns to switch HSV -> LCH
|
|
299
|
+
- update ColorFactory, TypedColor ([8c5f8fb](https://github.com/thi-ng/umbrella/commit/8c5f8fb))
|
|
300
|
+
- add `Symbol.toStringTag` impl
|
|
301
|
+
- expose `.class` in color factories
|
|
302
|
+
- add support for longer conversions (2-4 steps) in defConversions()
|
|
303
|
+
- add/update conversions ([e979044](https://github.com/thi-ng/umbrella/commit/e979044))
|
|
304
|
+
- update ColorMix & gradient types/functions ([829fcf6](https://github.com/thi-ng/umbrella/commit/829fcf6))
|
|
305
|
+
- add/update distance functions ([6d15065](https://github.com/thi-ng/umbrella/commit/6d15065))
|
|
306
|
+
- add distCIEDE2000()
|
|
307
|
+
- add distCMC()
|
|
308
|
+
- rename distRgb() => distEucledian3
|
|
309
|
+
- add distEucledian4
|
|
310
|
+
- replace proximity functions ([7a0be62](https://github.com/thi-ng/umbrella/commit/7a0be62))
|
|
311
|
+
- add new proximity() HOF to replace proximityHsv/Rgb()
|
|
312
312
|
|
|
313
313
|
#### 🩹 Bug fixes
|
|
314
314
|
|
|
315
|
-
- kelvinRgb() results are sRGB ([31cd4b5](https://github.com/thi-ng/umbrella/commit/31cd4b5))
|
|
316
|
-
- don't clamp Oklab/XYZ<>RGB conversions ([fab3639](https://github.com/thi-ng/umbrella/commit/fab3639))
|
|
317
|
-
- unconstrained analog() for some modes ([439265b](https://github.com/thi-ng/umbrella/commit/439265b))
|
|
318
|
-
- rescale labXyz(), use D50 for LCH->RGB ([9e59545](https://github.com/thi-ng/umbrella/commit/9e59545))
|
|
319
|
-
- fix typo in parseHex, update parse helpers ([a7315c0](https://github.com/thi-ng/umbrella/commit/a7315c0))
|
|
320
|
-
- div-by-zero in XYY<>XYZ conversions ([8a71c6e](https://github.com/thi-ng/umbrella/commit/8a71c6e))
|
|
321
|
-
- update Lab/LCH rules in parseCss() ([cb7f15e](https://github.com/thi-ng/umbrella/commit/cb7f15e))
|
|
322
|
-
- update resolveAsCss() ([0e7e955](https://github.com/thi-ng/umbrella/commit/0e7e955))
|
|
323
|
-
- constrain arg type, add string test/case
|
|
324
|
-
- normalize LCH hue channel ([c0b9e9d](https://github.com/thi-ng/umbrella/commit/c0b9e9d))
|
|
325
315
|
- fix resolveAsCSS() ([7b1eeff](https://github.com/thi-ng/umbrella/commit/7b1eeff))
|
|
326
316
|
- color mode field is a string now, not number anymore
|
|
327
317
|
- wi/o this fix any non-RGB color would be wrongly interpreted as RGBA
|
|
318
|
+
- normalize LCH hue channel ([c0b9e9d](https://github.com/thi-ng/umbrella/commit/c0b9e9d))
|
|
319
|
+
- update resolveAsCss() ([0e7e955](https://github.com/thi-ng/umbrella/commit/0e7e955))
|
|
320
|
+
- constrain arg type, add string test/case
|
|
321
|
+
- update Lab/LCH rules in parseCss() ([cb7f15e](https://github.com/thi-ng/umbrella/commit/cb7f15e))
|
|
322
|
+
- div-by-zero in XYY<>XYZ conversions ([8a71c6e](https://github.com/thi-ng/umbrella/commit/8a71c6e))
|
|
323
|
+
- fix typo in parseHex, update parse helpers ([a7315c0](https://github.com/thi-ng/umbrella/commit/a7315c0))
|
|
324
|
+
- rescale labXyz(), use D50 for LCH->RGB ([9e59545](https://github.com/thi-ng/umbrella/commit/9e59545))
|
|
325
|
+
- unconstrained analog() for some modes ([439265b](https://github.com/thi-ng/umbrella/commit/439265b))
|
|
326
|
+
- don't clamp Oklab/XYZ<>RGB conversions ([fab3639](https://github.com/thi-ng/umbrella/commit/fab3639))
|
|
327
|
+
- kelvinRgb() results are sRGB ([31cd4b5](https://github.com/thi-ng/umbrella/commit/31cd4b5))
|
|
328
328
|
|
|
329
329
|
#### ⏱ Performance improvements
|
|
330
330
|
|
|
@@ -332,53 +332,53 @@ and/or version bumps of transitive dependencies.
|
|
|
332
332
|
|
|
333
333
|
#### ♻️ Refactoring
|
|
334
334
|
|
|
335
|
-
- update
|
|
336
|
-
|
|
337
|
-
- update
|
|
338
|
-
-
|
|
339
|
-
-
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
-
|
|
335
|
+
- minor update mode getter impls ([bacc446](https://github.com/thi-ng/umbrella/commit/bacc446))
|
|
336
|
+
- add/update pkg exports ([f6826dd](https://github.com/thi-ng/umbrella/commit/f6826dd))
|
|
337
|
+
- update args for swatch fns ([e5b1b9b](https://github.com/thi-ng/umbrella/commit/e5b1b9b))
|
|
338
|
+
- rename GRADIENTS => COSINE_GRADIENTS ([22fe0de](https://github.com/thi-ng/umbrella/commit/22fe0de))
|
|
339
|
+
- migrate multiColorGradient() to separate file
|
|
340
|
+
- update ColorSpec handling ([d5d605e](https://github.com/thi-ng/umbrella/commit/d5d605e))
|
|
341
|
+
- make ChannelSpecs optional, update defaults handling in defColor()
|
|
342
|
+
- simplify int24Css() ([ebe3948](https://github.com/thi-ng/umbrella/commit/ebe3948))
|
|
343
|
+
- simplify defColor() factory fn ([afc300c](https://github.com/thi-ng/umbrella/commit/afc300c))
|
|
344
|
+
- update css() ([655dd32](https://github.com/thi-ng/umbrella/commit/655dd32))
|
|
345
|
+
- rename dynamic class in defColor() ([4c846d6](https://github.com/thi-ng/umbrella/commit/4c846d6))
|
|
346
|
+
- update backing buffer types ([b5661db](https://github.com/thi-ng/umbrella/commit/b5661db))
|
|
347
|
+
- use NumericArray (see related change in [0e4edb793](https://github.com/thi-ng/umbrella/commit/0e4edb793))
|
|
348
|
+
- update sortMapped() ([6b5fed9](https://github.com/thi-ng/umbrella/commit/6b5fed9))
|
|
349
|
+
- rename fns in gradient gen tool ([69e2287](https://github.com/thi-ng/umbrella/commit/69e2287))
|
|
346
350
|
- update int-int fns, docs, readme ([1ef7341](https://github.com/thi-ng/umbrella/commit/1ef7341))
|
|
347
351
|
- re-use swapLane13() for ARGB<>ABGR
|
|
348
352
|
- update deps
|
|
349
353
|
- update CSS ref links
|
|
350
354
|
- update readme
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
- update
|
|
354
|
-
|
|
355
|
-
-
|
|
356
|
-
- update
|
|
357
|
-
-
|
|
358
|
-
-
|
|
359
|
-
- update
|
|
360
|
-
|
|
361
|
-
-
|
|
362
|
-
- migrate multiColorGradient() to separate file
|
|
363
|
-
- update args for swatch fns ([e5b1b9b](https://github.com/thi-ng/umbrella/commit/e5b1b9b))
|
|
364
|
-
- add/update pkg exports ([f6826dd](https://github.com/thi-ng/umbrella/commit/f6826dd))
|
|
365
|
-
- minor update mode getter impls ([bacc446](https://github.com/thi-ng/umbrella/commit/bacc446))
|
|
355
|
+
- replace ensureHue() w/ fract() ([1499904](https://github.com/thi-ng/umbrella/commit/1499904))
|
|
356
|
+
- add/rename luminance consts, add docs ([9d43274](https://github.com/thi-ng/umbrella/commit/9d43274))
|
|
357
|
+
- update colorFromRange(), asThemePart() ([2e4e14d](https://github.com/thi-ng/umbrella/commit/2e4e14d))
|
|
358
|
+
- add ColorRangeOpts.base, update related fns ([e06c7ee](https://github.com/thi-ng/umbrella/commit/e06c7ee))
|
|
359
|
+
- move base arg into ColorRangeOpts
|
|
360
|
+
- update colorFromRange(), colorsFromRange(), colorsFromTheme()
|
|
361
|
+
- update LAB<>LCH conversions ([eb03c89](https://github.com/thi-ng/umbrella/commit/eb03c89))
|
|
362
|
+
- update types ([729db15](https://github.com/thi-ng/umbrella/commit/729db15))
|
|
363
|
+
- update parseHex 3/4 digit handling ([7424906](https://github.com/thi-ng/umbrella/commit/7424906))
|
|
364
|
+
- update color range presets ([9353c93](https://github.com/thi-ng/umbrella/commit/9353c93))
|
|
365
|
+
- adjust/balance settings for LCH (from former HSV configs)
|
|
366
366
|
|
|
367
367
|
## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@2.1.0) (2021-01-02)
|
|
368
368
|
|
|
369
369
|
#### 🚀 Features
|
|
370
370
|
|
|
371
|
-
-
|
|
372
|
-
- add
|
|
373
|
-
- add sortColors(), comparators ([6761feb](https://github.com/thi-ng/umbrella/commit/6761feb))
|
|
371
|
+
- add HSV/RGB distance fns ([3bd3969](https://github.com/thi-ng/umbrella/commit/3bd3969))
|
|
372
|
+
- add HSV/RGB gray axis checks ([927202b](https://github.com/thi-ng/umbrella/commit/927202b))
|
|
374
373
|
- add declarative range/theme iterators ([971d5dc](https://github.com/thi-ng/umbrella/commit/971d5dc))
|
|
375
374
|
- add ColorRange related types
|
|
376
375
|
- add ColorRange presets
|
|
377
376
|
- add colorFromRange()
|
|
378
377
|
- add colorsFromRange(), colorsFromTheme() iterators
|
|
379
378
|
- add analogHSV(), analogRGB() functions
|
|
380
|
-
- add
|
|
381
|
-
- add
|
|
379
|
+
- add sortColors(), comparators ([6761feb](https://github.com/thi-ng/umbrella/commit/6761feb))
|
|
380
|
+
- add color swatch hiccup helpers ([5ecc528](https://github.com/thi-ng/umbrella/commit/5ecc528))
|
|
381
|
+
- update ColorRangeOpts, add docstrings ([350fbe5](https://github.com/thi-ng/umbrella/commit/350fbe5))
|
|
382
382
|
|
|
383
383
|
#### 🩹 Bug fixes
|
|
384
384
|
|
|
@@ -386,16 +386,16 @@ and/or version bumps of transitive dependencies.
|
|
|
386
386
|
|
|
387
387
|
#### ♻️ Refactoring
|
|
388
388
|
|
|
389
|
+
- add/migrate types for presets ([a8e815b](https://github.com/thi-ng/umbrella/commit/a8e815b))
|
|
390
|
+
- update color range iterators ([ea1acc8](https://github.com/thi-ng/umbrella/commit/ea1acc8))
|
|
391
|
+
- update colorsFromTheme() & asThemePart() to precompute spec details
|
|
392
|
+
- minor update colorFromRange() (opts)
|
|
389
393
|
- replace ColorThemePartString ([efbb6f3](https://github.com/thi-ng/umbrella/commit/efbb6f3))
|
|
390
394
|
- add ColorThemePartTuple
|
|
391
395
|
- update asThemePart() to convert tuple versions
|
|
392
396
|
- to avoid TS typecheck perf issues w/ the template literal string,
|
|
393
397
|
switch to a tuple format for theme parts
|
|
394
398
|
- update swatch tool
|
|
395
|
-
- update color range iterators ([ea1acc8](https://github.com/thi-ng/umbrella/commit/ea1acc8))
|
|
396
|
-
- update colorsFromTheme() & asThemePart() to precompute spec details
|
|
397
|
-
- minor update colorFromRange() (opts)
|
|
398
|
-
- add/migrate types for presets ([a8e815b](https://github.com/thi-ng/umbrella/commit/a8e815b))
|
|
399
399
|
|
|
400
400
|
# [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@2.0.0) (2020-12-22)
|
|
401
401
|
|
|
@@ -450,9 +450,9 @@ and/or version bumps of transitive dependencies.
|
|
|
450
450
|
|
|
451
451
|
#### ♻️ Refactoring
|
|
452
452
|
|
|
453
|
+
- update wrapSides/tween call sites in various pkgs ([ee8200c](https://github.com/thi-ng/umbrella/commit/ee8200c))
|
|
453
454
|
- update multiCosineGradient() ([0359d4a](https://github.com/thi-ng/umbrella/commit/0359d4a))
|
|
454
455
|
- update tween() args due to API change
|
|
455
|
-
- update wrapSides/tween call sites in various pkgs ([ee8200c](https://github.com/thi-ng/umbrella/commit/ee8200c))
|
|
456
456
|
|
|
457
457
|
## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@1.1.0) (2019-08-21)
|
|
458
458
|
|
|
@@ -490,9 +490,9 @@ and/or version bumps of transitive dependencies.
|
|
|
490
490
|
|
|
491
491
|
#### 🚀 Features
|
|
492
492
|
|
|
493
|
-
- TS strictNullChecks, update color conversion fns ([04dc356](https://github.com/thi-ng/umbrella/commit/04dc356))
|
|
494
493
|
- enable TS strict compiler flags (refactor) ([8c13166](https://github.com/thi-ng/umbrella/commit/8c13166))
|
|
495
494
|
- reformat color matrices in transform.ts
|
|
495
|
+
- TS strictNullChecks, update color conversion fns ([04dc356](https://github.com/thi-ng/umbrella/commit/04dc356))
|
|
496
496
|
|
|
497
497
|
### [0.1.11](https://github.com/thi-ng/umbrella/tree/@thi.ng/color@0.1.11) (2019-03-10)
|
|
498
498
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/color",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.10",
|
|
4
4
|
"description": "Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,26 +36,26 @@
|
|
|
36
36
|
"tool:swatches": "tools:node-esm tools/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.4.
|
|
40
|
-
"@thi.ng/arrays": "^2.4.
|
|
41
|
-
"@thi.ng/binary": "^3.3.
|
|
42
|
-
"@thi.ng/checks": "^3.3.
|
|
43
|
-
"@thi.ng/compare": "^2.1.
|
|
44
|
-
"@thi.ng/compose": "^2.1.
|
|
45
|
-
"@thi.ng/defmulti": "^2.1.
|
|
46
|
-
"@thi.ng/errors": "^2.2.
|
|
47
|
-
"@thi.ng/math": "^5.3.
|
|
48
|
-
"@thi.ng/random": "^3.3.
|
|
49
|
-
"@thi.ng/strings": "^3.3.
|
|
50
|
-
"@thi.ng/transducers": "^8.3.
|
|
51
|
-
"@thi.ng/vectors": "^7.5.
|
|
39
|
+
"@thi.ng/api": "^8.4.6",
|
|
40
|
+
"@thi.ng/arrays": "^2.4.2",
|
|
41
|
+
"@thi.ng/binary": "^3.3.10",
|
|
42
|
+
"@thi.ng/checks": "^3.3.3",
|
|
43
|
+
"@thi.ng/compare": "^2.1.16",
|
|
44
|
+
"@thi.ng/compose": "^2.1.18",
|
|
45
|
+
"@thi.ng/defmulti": "^2.1.21",
|
|
46
|
+
"@thi.ng/errors": "^2.2.4",
|
|
47
|
+
"@thi.ng/math": "^5.3.13",
|
|
48
|
+
"@thi.ng/random": "^3.3.15",
|
|
49
|
+
"@thi.ng/strings": "^3.3.17",
|
|
50
|
+
"@thi.ng/transducers": "^8.3.23",
|
|
51
|
+
"@thi.ng/vectors": "^7.5.24"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@microsoft/api-extractor": "^7.33.5",
|
|
55
|
-
"@thi.ng/testament": "^0.3.
|
|
55
|
+
"@thi.ng/testament": "^0.3.5",
|
|
56
56
|
"rimraf": "^3.0.2",
|
|
57
57
|
"tools": "^0.0.1",
|
|
58
|
-
"typedoc": "^0.23.
|
|
58
|
+
"typedoc": "^0.23.20",
|
|
59
59
|
"typescript": "^4.8.4"
|
|
60
60
|
},
|
|
61
61
|
"keywords": [
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"node": ">=12.7"
|
|
104
104
|
},
|
|
105
105
|
"files": [
|
|
106
|
-
"
|
|
107
|
-
"
|
|
106
|
+
"./*.js",
|
|
107
|
+
"./*.d.ts",
|
|
108
108
|
"api",
|
|
109
109
|
"css",
|
|
110
110
|
"hcy",
|
|
@@ -424,5 +424,5 @@
|
|
|
424
424
|
"vectors"
|
|
425
425
|
]
|
|
426
426
|
},
|
|
427
|
-
"gitHead": "
|
|
427
|
+
"gitHead": "044ee6a3895720fc78e115032d4d831b63510929\n"
|
|
428
428
|
}
|
package/dev/hsluv.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
function f(a) {
|
|
3
|
-
var c = [],
|
|
4
|
-
b = Math.pow(a + 16, 3) / 1560896;
|
|
5
|
-
b = b > g ? b : a / k;
|
|
6
|
-
for (var d = 0; 3 > d; ) {
|
|
7
|
-
var e = d++,
|
|
8
|
-
h = l[e][0],
|
|
9
|
-
w = l[e][1];
|
|
10
|
-
e = l[e][2];
|
|
11
|
-
for (var x = 0; 2 > x; ) {
|
|
12
|
-
var y = x++,
|
|
13
|
-
z = (632260 * e - 126452 * w) * b + 126452 * y;
|
|
14
|
-
c.push({
|
|
15
|
-
b: ((284517 * h - 94839 * e) * b) / z,
|
|
16
|
-
a:
|
|
17
|
-
((838422 * e + 769860 * w + 731718 * h) * a * b -
|
|
18
|
-
769860 * y * a) /
|
|
19
|
-
z,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return c;
|
|
24
|
-
}
|
|
25
|
-
function m(a) {
|
|
26
|
-
a = f(a);
|
|
27
|
-
for (var c = Infinity, b = 0; b < a.length; ) {
|
|
28
|
-
var d = a[b];
|
|
29
|
-
++b;
|
|
30
|
-
c = Math.min(c, Math.abs(d.a) / Math.sqrt(Math.pow(d.b, 2) + 1));
|
|
31
|
-
}
|
|
32
|
-
return c;
|
|
33
|
-
}
|
|
34
|
-
function n(a, c) {
|
|
35
|
-
c = (c / 360) * Math.PI * 2;
|
|
36
|
-
a = f(a);
|
|
37
|
-
for (var b = Infinity, d = 0; d < a.length; ) {
|
|
38
|
-
var e = a[d];
|
|
39
|
-
++d;
|
|
40
|
-
e = e.a / (Math.sin(c) - e.b * Math.cos(c));
|
|
41
|
-
0 <= e && (b = Math.min(b, e));
|
|
42
|
-
}
|
|
43
|
-
return b;
|
|
44
|
-
}
|
|
45
|
-
function p(a, c) {
|
|
46
|
-
for (var b = 0, d = 0, e = a.length; d < e; ) {
|
|
47
|
-
var h = d++;
|
|
48
|
-
b += a[h] * c[h];
|
|
49
|
-
}
|
|
50
|
-
return b;
|
|
51
|
-
}
|
|
52
|
-
function q(a) {
|
|
53
|
-
return 0.0031308 >= a
|
|
54
|
-
? 12.92 * a
|
|
55
|
-
: 1.055 * Math.pow(a, 0.4166666666666667) - 0.055;
|
|
56
|
-
}
|
|
57
|
-
function r(a) {
|
|
58
|
-
return 0.04045 < a ? Math.pow((a + 0.055) / 1.055, 2.4) : a / 12.92;
|
|
59
|
-
}
|
|
60
|
-
function t(a) {
|
|
61
|
-
return [q(p(l[0], a)), q(p(l[1], a)), q(p(l[2], a))];
|
|
62
|
-
}
|
|
63
|
-
function u(a) {
|
|
64
|
-
a = [r(a[0]), r(a[1]), r(a[2])];
|
|
65
|
-
return [p(v[0], a), p(v[1], a), p(v[2], a)];
|
|
66
|
-
}
|
|
67
|
-
function A(a) {
|
|
68
|
-
var c = a[0],
|
|
69
|
-
b = a[1];
|
|
70
|
-
a = c + 15 * b + 3 * a[2];
|
|
71
|
-
0 != a ? ((c = (4 * c) / a), (a = (9 * b) / a)) : (a = c = NaN);
|
|
72
|
-
b =
|
|
73
|
-
b <= g
|
|
74
|
-
? (b / B) * k
|
|
75
|
-
: 116 * Math.pow(b / B, 0.3333333333333333) - 16;
|
|
76
|
-
return 0 == b ? [0, 0, 0] : [b, 13 * b * (c - C), 13 * b * (a - D)];
|
|
77
|
-
}
|
|
78
|
-
function E(a) {
|
|
79
|
-
var c = a[0];
|
|
80
|
-
if (0 == c) return [0, 0, 0];
|
|
81
|
-
var b = a[1] / (13 * c) + C;
|
|
82
|
-
a = a[2] / (13 * c) + D;
|
|
83
|
-
c = 8 >= c ? (B * c) / k : B * Math.pow((c + 16) / 116, 3);
|
|
84
|
-
b = 0 - (9 * c * b) / ((b - 4) * a - b * a);
|
|
85
|
-
return [b, c, (9 * c - 15 * a * c - a * b) / (3 * a)];
|
|
86
|
-
}
|
|
87
|
-
function F(a) {
|
|
88
|
-
var c = a[0],
|
|
89
|
-
b = a[1],
|
|
90
|
-
d = a[2];
|
|
91
|
-
a = Math.sqrt(b * b + d * d);
|
|
92
|
-
1e-8 > a
|
|
93
|
-
? (b = 0)
|
|
94
|
-
: ((b = (180 * Math.atan2(d, b)) / Math.PI),
|
|
95
|
-
0 > b && (b = 360 + b));
|
|
96
|
-
return [c, a, b];
|
|
97
|
-
}
|
|
98
|
-
function G(a) {
|
|
99
|
-
var c = a[1],
|
|
100
|
-
b = (a[2] / 360) * 2 * Math.PI;
|
|
101
|
-
return [a[0], Math.cos(b) * c, Math.sin(b) * c];
|
|
102
|
-
}
|
|
103
|
-
function H(a) {
|
|
104
|
-
var c = a[0],
|
|
105
|
-
b = a[1];
|
|
106
|
-
a = a[2];
|
|
107
|
-
if (99.9999999 < a) return [100, 0, c];
|
|
108
|
-
if (1e-8 > a) return [0, 0, c];
|
|
109
|
-
b = (n(a, c) / 100) * b;
|
|
110
|
-
return [a, b, c];
|
|
111
|
-
}
|
|
112
|
-
function I(a) {
|
|
113
|
-
var c = a[0],
|
|
114
|
-
b = a[1];
|
|
115
|
-
a = a[2];
|
|
116
|
-
if (99.9999999 < c) return [a, 0, 100];
|
|
117
|
-
if (1e-8 > c) return [a, 0, 0];
|
|
118
|
-
var d = n(c, a);
|
|
119
|
-
return [a, (b / d) * 100, c];
|
|
120
|
-
}
|
|
121
|
-
function J(a) {
|
|
122
|
-
var c = a[0],
|
|
123
|
-
b = a[1];
|
|
124
|
-
a = a[2];
|
|
125
|
-
if (99.9999999 < a) return [100, 0, c];
|
|
126
|
-
if (1e-8 > a) return [0, 0, c];
|
|
127
|
-
b = (m(a) / 100) * b;
|
|
128
|
-
return [a, b, c];
|
|
129
|
-
}
|
|
130
|
-
function K(a) {
|
|
131
|
-
var c = a[0],
|
|
132
|
-
b = a[1];
|
|
133
|
-
a = a[2];
|
|
134
|
-
if (99.9999999 < c) return [a, 0, 100];
|
|
135
|
-
if (1e-8 > c) return [a, 0, 0];
|
|
136
|
-
var d = m(c);
|
|
137
|
-
return [a, (b / d) * 100, c];
|
|
138
|
-
}
|
|
139
|
-
function L(a) {
|
|
140
|
-
for (var c = "#", b = 0; 3 > b; ) {
|
|
141
|
-
var d = b++;
|
|
142
|
-
d = Math.round(255 * a[d]);
|
|
143
|
-
var e = d % 16;
|
|
144
|
-
c += M.charAt(((d - e) / 16) | 0) + M.charAt(e);
|
|
145
|
-
}
|
|
146
|
-
return c;
|
|
147
|
-
}
|
|
148
|
-
function N(a) {
|
|
149
|
-
a = a.toLowerCase();
|
|
150
|
-
for (var c = [], b = 0; 3 > b; ) {
|
|
151
|
-
var d = b++;
|
|
152
|
-
c.push(
|
|
153
|
-
(16 * M.indexOf(a.charAt(2 * d + 1)) +
|
|
154
|
-
M.indexOf(a.charAt(2 * d + 2))) /
|
|
155
|
-
255
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
return c;
|
|
159
|
-
}
|
|
160
|
-
function O(a) {
|
|
161
|
-
return t(E(G(a)));
|
|
162
|
-
}
|
|
163
|
-
function P(a) {
|
|
164
|
-
return F(A(u(a)));
|
|
165
|
-
}
|
|
166
|
-
function Q(a) {
|
|
167
|
-
return O(H(a));
|
|
168
|
-
}
|
|
169
|
-
function R(a) {
|
|
170
|
-
return I(P(a));
|
|
171
|
-
}
|
|
172
|
-
function S(a) {
|
|
173
|
-
return O(J(a));
|
|
174
|
-
}
|
|
175
|
-
function T(a) {
|
|
176
|
-
return K(P(a));
|
|
177
|
-
}
|
|
178
|
-
var l = [
|
|
179
|
-
[3.240969941904521, -1.537383177570093, -0.498610760293],
|
|
180
|
-
[-0.96924363628087, 1.87596750150772, 0.041555057407175],
|
|
181
|
-
[0.055630079696993, -0.20397695888897, 1.056971514242878],
|
|
182
|
-
],
|
|
183
|
-
v = [
|
|
184
|
-
[0.41239079926595, 0.35758433938387, 0.18048078840183],
|
|
185
|
-
[0.21263900587151, 0.71516867876775, 0.072192315360733],
|
|
186
|
-
[0.019330818715591, 0.11919477979462, 0.95053215224966],
|
|
187
|
-
],
|
|
188
|
-
B = 1,
|
|
189
|
-
C = 0.19783000664283,
|
|
190
|
-
D = 0.46831999493879,
|
|
191
|
-
k = 903.2962962,
|
|
192
|
-
g = 0.0088564516,
|
|
193
|
-
M = "0123456789abcdef";
|
|
194
|
-
window.hsluv = {
|
|
195
|
-
hsluvToRgb: Q,
|
|
196
|
-
rgbToHsluv: R,
|
|
197
|
-
hpluvToRgb: S,
|
|
198
|
-
rgbToHpluv: T,
|
|
199
|
-
hsluvToHex: function (a) {
|
|
200
|
-
return L(Q(a));
|
|
201
|
-
},
|
|
202
|
-
hexToHsluv: function (a) {
|
|
203
|
-
return R(N(a));
|
|
204
|
-
},
|
|
205
|
-
hpluvToHex: function (a) {
|
|
206
|
-
return L(S(a));
|
|
207
|
-
},
|
|
208
|
-
hexToHpluv: function (a) {
|
|
209
|
-
return T(N(a));
|
|
210
|
-
},
|
|
211
|
-
lchToHpluv: K,
|
|
212
|
-
hpluvToLch: J,
|
|
213
|
-
lchToHsluv: I,
|
|
214
|
-
hsluvToLch: H,
|
|
215
|
-
lchToLuv: G,
|
|
216
|
-
luvToLch: F,
|
|
217
|
-
xyzToLuv: A,
|
|
218
|
-
luvToXyz: E,
|
|
219
|
-
xyzToRgb: t,
|
|
220
|
-
rgbToXyz: u,
|
|
221
|
-
lchToRgb: O,
|
|
222
|
-
rgbToLch: P,
|
|
223
|
-
};
|
|
224
|
-
})();
|