@fibery/ui-kit 1.40.2 → 1.40.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +4 -7
  3. package/src/__snapshots__/design-system.test.ts.snap +7265 -0
  4. package/src/a11y-color.test.ts +181 -0
  5. package/src/a11y-color.ts +13 -20
  6. package/src/actions-menu/actions-menu-item.tsx +7 -7
  7. package/src/antd/ant-modal.tsx +10 -5
  8. package/src/antd/styles.ts +6 -6
  9. package/src/app-icon-with-fallback.tsx +2 -2
  10. package/src/app-icon.tsx +2 -2
  11. package/src/button/button.tsx +1 -0
  12. package/src/button/make-button-colors.ts +5 -13
  13. package/src/checkbox.tsx +2 -2
  14. package/src/color-picker/ColorPickerOrLoader.js +2 -2
  15. package/src/color-utils.test.ts +317 -0
  16. package/src/color-utils.ts +180 -0
  17. package/src/comment.tsx +3 -2
  18. package/src/context-menu/index.tsx +12 -7
  19. package/src/create-inline-theme.ts +9 -8
  20. package/src/design-system.colors.ts +760 -0
  21. package/src/design-system.test.ts +287 -7
  22. package/src/design-system.ts +146 -940
  23. package/src/dropdown-menu/index.tsx +21 -16
  24. package/src/emoji-picker/app-icon-picker.tsx +5 -5
  25. package/src/emoji-picker/emoji-picker-content-with-color.tsx +4 -4
  26. package/src/emoji-picker/icon-emoji-picker.tsx +2 -2
  27. package/src/favorites-icon.tsx +1 -1
  28. package/src/file-item/file-icon.tsx +169 -0
  29. package/src/file-item/file-menu-items.tsx +68 -0
  30. package/src/file-item/file-preview-actions.tsx +38 -0
  31. package/src/file-item/file-title.tsx +48 -0
  32. package/src/file-item/types.ts +27 -0
  33. package/src/file-item/use-register-in-image-gallery.tsx +70 -0
  34. package/src/file-item-2.tsx +35 -345
  35. package/src/file-item.tsx +6 -2
  36. package/src/hue-shift.test.ts +91 -0
  37. package/src/icons/Icon.tsx +1 -0
  38. package/src/icons/ast/FileCounter.ts +8 -0
  39. package/src/icons/ast/FileMultiple.ts +8 -0
  40. package/src/icons/ast/Print.ts +8 -0
  41. package/src/icons/ast/ValueEdit.ts +8 -0
  42. package/src/icons/ast/index.tsx +4 -0
  43. package/src/icons/react/Dividers.tsx +1 -1
  44. package/src/icons/react/FileCounter.tsx +13 -0
  45. package/src/icons/react/FileMultiple.tsx +13 -0
  46. package/src/icons/react/Print.tsx +13 -0
  47. package/src/icons/react/ValueEdit.tsx +13 -0
  48. package/src/icons/react/index.tsx +4 -0
  49. package/src/icons/svg/file-counter.svg +3 -0
  50. package/src/icons/svg/file-multiple.svg +3 -0
  51. package/src/icons/svg/print.svg +3 -0
  52. package/src/icons/svg/value-edit.svg +3 -0
  53. package/src/images-gallery/slide-buttons.tsx +4 -11
  54. package/src/lists/actions-menu-row-surface.tsx +5 -5
  55. package/src/mobile-keyboard-aware-popup.tsx +4 -3
  56. package/src/palette-generator.test.ts +566 -0
  57. package/src/palette-generator.ts +166 -0
  58. package/src/palette.ts +71 -55
  59. package/src/platform.ts +0 -3
  60. package/src/popover/index.tsx +20 -28
  61. package/src/progress.tsx +2 -2
  62. package/src/reactions/reaction-button.tsx +12 -6
  63. package/src/root-theme-provider.test.tsx +316 -0
  64. package/src/scale-generator.ts +347 -0
  65. package/src/select/components/menu-list-virtualized.tsx +7 -22
  66. package/src/select/components/menu.tsx +12 -2
  67. package/src/select/select.tsx +2 -1
  68. package/src/select/styles.ts +0 -1
  69. package/src/static-palettes.ts +146 -0
  70. package/src/thematic-color-picker.tsx +266 -0
  71. package/src/thematic-constants.tsx +27 -0
  72. package/src/thematic-controls.tsx +144 -0
  73. package/src/thematic-scales.tsx +122 -0
  74. package/src/thematic-state.ts +333 -0
  75. package/src/thematic.tsx +382 -0
  76. package/src/theme-provider.test.tsx +808 -0
  77. package/src/theme-provider.tsx +132 -69
  78. package/src/theme-settings.ts +1 -1
  79. package/src/theme-styles.ts +12 -5
  80. package/src/toast/toast-action.tsx +1 -1
  81. package/src/toggle-on-off.tsx +2 -2
  82. package/src/toggle.tsx +5 -6
  83. package/src/tooltip.tsx +13 -10
  84. package/src/type-badge.tsx +3 -3
  85. package/src/unit/styles.ts +2 -2
  86. package/src/unit/unit-with-tooltip.tsx +3 -2
  87. package/src/use-long-press.tsx +2 -2
@@ -0,0 +1,566 @@
1
+ /* eslint-disable max-lines */
2
+ import {getAlpha, OKLCH, parse, to, toOKLCH} from "./color-utils";
3
+ import {type ColorScale, makeDefaultPalette, makeThematicPalette} from "./palette-generator";
4
+
5
+ function roundToThreeDigits(number: number) {
6
+ return Math.round(number * 1000) / 1000;
7
+ }
8
+
9
+ function getOklch(color: string): {l: number; c: number; h: number} {
10
+ const oklch = to(parse(color), OKLCH);
11
+ return {
12
+ l: roundToThreeDigits(100 * (oklch.coords[0] ?? 0)),
13
+ c: oklch.coords[1] ?? 0,
14
+ h: oklch.coords[2] ?? 0,
15
+ };
16
+ }
17
+
18
+ function extractLightness(scale: ColorScale): number[] {
19
+ return scale.slice(1).map((color) => getOklch(color).l);
20
+ }
21
+
22
+ function extractChromaNormalized(scale: ColorScale): number[] {
23
+ const chromas = scale.slice(1).map((color) => getOklch(color).c);
24
+ const maxChroma = Math.max(...chromas);
25
+ return chromas.map((c) => roundToThreeDigits(c / maxChroma));
26
+ }
27
+
28
+ describe("palette-generator", () => {
29
+ describe("extract curves from default palette", () => {
30
+ it("extracts YELLOW curves", () => {
31
+ const palette = makeDefaultPalette();
32
+ expect(extractLightness(palette.yellow)).toMatchInlineSnapshot(`
33
+ [
34
+ 99.15,
35
+ 98.666,
36
+ 98.103,
37
+ 97.119,
38
+ 95.34,
39
+ 92.061,
40
+ 86.841,
41
+ 81.273,
42
+ 88.224,
43
+ 85.516,
44
+ 54.771,
45
+ 28.162,
46
+ ]
47
+ `);
48
+ expect(extractChromaNormalized(palette.yellow)).toMatchInlineSnapshot(`
49
+ [
50
+ 0.04,
51
+ 0.16,
52
+ 0.299,
53
+ 0.419,
54
+ 0.539,
55
+ 0.621,
56
+ 0.692,
57
+ 0.911,
58
+ 1,
59
+ 0.962,
60
+ 0.624,
61
+ 0.231,
62
+ ]
63
+ `);
64
+ expect(extractLightness(palette.yellowDark)).toMatchInlineSnapshot(`
65
+ [
66
+ 18.975,
67
+ 22.715,
68
+ 25.994,
69
+ 27.672,
70
+ 31.467,
71
+ 35.323,
72
+ 40.577,
73
+ 48.421,
74
+ 88.224,
75
+ 93.814,
76
+ 82.593,
77
+ 97.801,
78
+ ]
79
+ `);
80
+ expect(extractChromaNormalized(palette.yellowDark)).toMatchInlineSnapshot(`
81
+ [
82
+ 0.213,
83
+ 0.255,
84
+ 0.291,
85
+ 0.31,
86
+ 0.353,
87
+ 0.398,
88
+ 0.444,
89
+ 0.546,
90
+ 1,
91
+ 0.898,
92
+ 0.926,
93
+ 0.289,
94
+ ]
95
+ `);
96
+ // Extract hue from step 9 (primary yellow)
97
+ expect(getOklch(palette.yellow[9]).h).toMatchInlineSnapshot(`99.99954352835232`);
98
+ });
99
+
100
+ it("extracts SLATE curves", () => {
101
+ const palette = makeDefaultPalette();
102
+ expect(extractLightness(palette.base)).toMatchInlineSnapshot(`
103
+ [
104
+ 99.241,
105
+ 97.719,
106
+ 96.955,
107
+ 94.656,
108
+ 93.115,
109
+ 91.568,
110
+ 89.235,
111
+ 82.937,
112
+ 69.959,
113
+ 57.217,
114
+ 48.318,
115
+ 20.441,
116
+ ]
117
+ `);
118
+ expect(extractLightness(palette.baseDark)).toMatchInlineSnapshot(`
119
+ [
120
+ 20.441,
121
+ 22.667,
122
+ 25.908,
123
+ 28.012,
124
+ 30.078,
125
+ 32.109,
126
+ 36.079,
127
+ 43.714,
128
+ 54.586,
129
+ 59.818,
130
+ 70.787,
131
+ 94.656,
132
+ ]
133
+ `);
134
+ });
135
+
136
+ it("extracts INDIGO curves", () => {
137
+ const palette = makeDefaultPalette();
138
+ expect(extractLightness(palette.accent)).toMatchInlineSnapshot(`
139
+ [
140
+ 99.069,
141
+ 98.983,
142
+ 96.966,
143
+ 95.012,
144
+ 92.145,
145
+ 88.367,
146
+ 82.757,
147
+ 76.14,
148
+ 58.48,
149
+ 54.173,
150
+ 49.642,
151
+ 26.071,
152
+ ]
153
+ `);
154
+ expect(extractChromaNormalized(palette.accent)).toMatchInlineSnapshot(`
155
+ [
156
+ 0.018,
157
+ 0.027,
158
+ 0.08,
159
+ 0.126,
160
+ 0.19,
161
+ 0.27,
162
+ 0.384,
163
+ 0.529,
164
+ 0.934,
165
+ 1,
166
+ 0.878,
167
+ 0.44,
168
+ ]
169
+ `);
170
+ expect(extractLightness(palette.accentDark)).toMatchInlineSnapshot(`
171
+ [
172
+ 20.512,
173
+ 22.974,
174
+ 27.284,
175
+ 29.742,
176
+ 32.452,
177
+ 35.981,
178
+ 41.256,
179
+ 47.972,
180
+ 57.658,
181
+ 62.928,
182
+ 76.225,
183
+ 95.899,
184
+ ]
185
+ `);
186
+ expect(extractChromaNormalized(palette.accentDark)).toMatchInlineSnapshot(`
187
+ [
188
+ 0.119,
189
+ 0.226,
190
+ 0.357,
191
+ 0.444,
192
+ 0.475,
193
+ 0.517,
194
+ 0.72,
195
+ 0.952,
196
+ 1,
197
+ 0.921,
198
+ 0.601,
199
+ 0.111,
200
+ ]
201
+ `);
202
+ });
203
+ });
204
+
205
+ describe("makeDefaultPalette", () => {
206
+ it("snapshots default palette in OKLCH", () => {
207
+ const palette = makeDefaultPalette();
208
+ expect({
209
+ base: palette.base.map(toOKLCH),
210
+ baseDark: palette.baseDark.map(toOKLCH),
211
+ accent: palette.accent.map(toOKLCH),
212
+ accentDark: palette.accentDark.map(toOKLCH),
213
+ }).toMatchInlineSnapshot(`
214
+ {
215
+ "accent": [
216
+ "oklch(100% 0 none)",
217
+ "oklch(99.069% 0.00291 264.54)",
218
+ "oklch(98.983% 0.00437 264.54)",
219
+ "oklch(96.966% 0.01293 264.51)",
220
+ "oklch(95.012% 0.02046 264.47)",
221
+ "oklch(92.145% 0.03068 264.41)",
222
+ "oklch(88.367% 0.04361 264.32)",
223
+ "oklch(82.757% 0.06206 264.15)",
224
+ "oklch(76.14% 0.08554 263.86)",
225
+ "oklch(58.48% 0.15116 262.64)",
226
+ "oklch(54.173% 0.16179 262.38)",
227
+ "oklch(49.642% 0.14201 262.46)",
228
+ "oklch(26.071% 0.07125 262.54)",
229
+ ],
230
+ "accentDark": [
231
+ "oklch(100% 0 none)",
232
+ "oklch(20.512% 0.01807 266.69)",
233
+ "oklch(22.974% 0.03429 266.01)",
234
+ "oklch(27.284% 0.05415 265.42)",
235
+ "oklch(29.742% 0.06735 265.08)",
236
+ "oklch(32.452% 0.07215 265.13)",
237
+ "oklch(35.981% 0.07843 265.18)",
238
+ "oklch(41.256% 0.10936 264.62)",
239
+ "oklch(47.972% 0.14454 264.22)",
240
+ "oklch(57.658% 0.15178 264.65)",
241
+ "oklch(62.928% 0.13984 265.13)",
242
+ "oklch(76.225% 0.09124 266.35)",
243
+ "oklch(95.899% 0.01681 267.31)",
244
+ ],
245
+ "base": [
246
+ "oklch(100% 0 none)",
247
+ "oklch(99.241% 0 none)",
248
+ "oklch(97.719% 0 none)",
249
+ "oklch(96.955% 0 none)",
250
+ "oklch(94.656% 0 none)",
251
+ "oklch(93.115% 0 none)",
252
+ "oklch(91.568% 0 none)",
253
+ "oklch(89.235% 0 none)",
254
+ "oklch(82.937% 0 none)",
255
+ "oklch(69.959% 0 none)",
256
+ "oklch(57.217% 0 none)",
257
+ "oklch(48.318% 0 none)",
258
+ "oklch(20.441% 0 none)",
259
+ ],
260
+ "baseDark": [
261
+ "oklch(15.789% 0 none)",
262
+ "oklch(20.441% 0 none)",
263
+ "oklch(22.667% 0 none)",
264
+ "oklch(25.908% 0 none)",
265
+ "oklch(28.012% 0 none)",
266
+ "oklch(30.078% 0 none)",
267
+ "oklch(32.109% 0 none)",
268
+ "oklch(36.079% 0 none)",
269
+ "oklch(43.714% 0 none)",
270
+ "oklch(54.586% 0 none)",
271
+ "oklch(59.818% 0 none)",
272
+ "oklch(70.787% 0 none)",
273
+ "oklch(94.656% 0 none)",
274
+ ],
275
+ }
276
+ `);
277
+ });
278
+ });
279
+
280
+ describe("white/black scales", () => {
281
+ it("generated neutral scales match default palette", () => {
282
+ const defaultPalette = makeDefaultPalette();
283
+ const generated = makeThematicPalette({
284
+ baseHue: 0,
285
+ baseChroma: 0,
286
+ accentHue: 264,
287
+ accentChroma: 0.16,
288
+ });
289
+
290
+ expect(generated.white).toMatchInlineSnapshot(`
291
+ [
292
+ "rgb(255,255,255)",
293
+ "rgba(255,255,255,0)",
294
+ "rgba(255,255,255,0.01)",
295
+ "rgba(255,255,255,0.03)",
296
+ "rgba(255,255,255,0.06)",
297
+ "rgba(255,255,255,0.09)",
298
+ "rgba(255,255,255,0.12)",
299
+ "rgba(255,255,255,0.18)",
300
+ "rgba(255,255,255,0.25)",
301
+ "rgba(255,255,255,0.39)",
302
+ "rgba(255,255,255,0.45)",
303
+ "rgba(255,255,255,0.59)",
304
+ "rgba(255,255,255,0.92)",
305
+ ]
306
+ `);
307
+ expect(generated.black).toMatchInlineSnapshot(`
308
+ [
309
+ "rgb(0,0,0)",
310
+ "rgba(0,0,0,0.01)",
311
+ "rgba(0,0,0,0.03)",
312
+ "rgba(0,0,0,0.05)",
313
+ "rgba(0,0,0,0.07)",
314
+ "rgba(0,0,0,0.09)",
315
+ "rgba(0,0,0,0.11)",
316
+ "rgba(0,0,0,0.14)",
317
+ "rgba(0,0,0,0.22)",
318
+ "rgba(0,0,0,0.44)",
319
+ "rgba(0,0,0,0.48)",
320
+ "rgba(0,0,0,0.57)",
321
+ "rgba(0,0,0,0.91)",
322
+ ]
323
+ `);
324
+
325
+ // default palette uses hsla strings, generated uses rgba — compare parsed alpha values
326
+ for (let i = 0; i < 13; i++) {
327
+ const defWhiteAlpha = getAlpha(defaultPalette.white[i]);
328
+ const genWhiteAlpha = getAlpha(generated.white[i]);
329
+ expect(genWhiteAlpha).toBeCloseTo(defWhiteAlpha, 2);
330
+
331
+ const defBlackAlpha = getAlpha(defaultPalette.black[i]);
332
+ const genBlackAlpha = getAlpha(generated.black[i]);
333
+ expect(genBlackAlpha).toBeCloseTo(defBlackAlpha, 2);
334
+ }
335
+ });
336
+ });
337
+
338
+ describe("white/black tinting across hues", () => {
339
+ it("white[0] should be tinted for all hues when chroma > 0", () => {
340
+ const hues = Array.from({length: 36}, (_, i) => i * 10);
341
+ const results = hues.map((hue) => {
342
+ const palette = makeThematicPalette({baseHue: hue, baseChroma: 0.175, accentHue: hue, accentChroma: 0.16});
343
+ return {hue, white0: palette.white[0], black0: palette.black[0]};
344
+ });
345
+
346
+ // Every hue should produce a tinted white (not pure #fff)
347
+ for (const {hue, white0} of results) {
348
+ expect({hue, white0}).not.toEqual({hue, white0: "rgb(255,255,255)"});
349
+ }
350
+
351
+ expect(results).toMatchInlineSnapshot(`
352
+ [
353
+ {
354
+ "black0": "rgb(3,0,1)",
355
+ "hue": 0,
356
+ "white0": "rgb(255,245,249)",
357
+ },
358
+ {
359
+ "black0": "rgb(3,0,1)",
360
+ "hue": 10,
361
+ "white0": "rgb(255,245,246)",
362
+ },
363
+ {
364
+ "black0": "rgb(3,0,1)",
365
+ "hue": 20,
366
+ "white0": "rgb(255,245,244)",
367
+ },
368
+ {
369
+ "black0": "rgb(3,0,0)",
370
+ "hue": 30,
371
+ "white0": "rgb(255,245,242)",
372
+ },
373
+ {
374
+ "black0": "rgb(3,1,0)",
375
+ "hue": 40,
376
+ "white0": "rgb(255,246,241)",
377
+ },
378
+ {
379
+ "black0": "rgb(3,1,0)",
380
+ "hue": 50,
381
+ "white0": "rgb(255,246,239)",
382
+ },
383
+ {
384
+ "black0": "rgb(3,1,0)",
385
+ "hue": 60,
386
+ "white0": "rgb(255,247,238)",
387
+ },
388
+ {
389
+ "black0": "rgb(2,1,0)",
390
+ "hue": 70,
391
+ "white0": "rgb(255,248,237)",
392
+ },
393
+ {
394
+ "black0": "rgb(2,1,0)",
395
+ "hue": 80,
396
+ "white0": "rgb(255,248,236)",
397
+ },
398
+ {
399
+ "black0": "rgb(2,1,0)",
400
+ "hue": 90,
401
+ "white0": "rgb(254,249,236)",
402
+ },
403
+ {
404
+ "black0": "rgb(2,1,0)",
405
+ "hue": 100,
406
+ "white0": "rgb(252,250,237)",
407
+ },
408
+ {
409
+ "black0": "rgb(1,1,0)",
410
+ "hue": 110,
411
+ "white0": "rgb(250,251,237)",
412
+ },
413
+ {
414
+ "black0": "rgb(1,1,0)",
415
+ "hue": 120,
416
+ "white0": "rgb(247,251,238)",
417
+ },
418
+ {
419
+ "black0": "rgb(1,1,0)",
420
+ "hue": 130,
421
+ "white0": "rgb(245,252,240)",
422
+ },
423
+ {
424
+ "black0": "rgb(0,2,0)",
425
+ "hue": 140,
426
+ "white0": "rgb(243,252,241)",
427
+ },
428
+ {
429
+ "black0": "rgb(0,2,0)",
430
+ "hue": 150,
431
+ "white0": "rgb(241,253,243)",
432
+ },
433
+ {
434
+ "black0": "rgb(0,2,1)",
435
+ "hue": 160,
436
+ "white0": "rgb(240,253,245)",
437
+ },
438
+ {
439
+ "black0": "rgb(0,2,1)",
440
+ "hue": 170,
441
+ "white0": "rgb(238,253,247)",
442
+ },
443
+ {
444
+ "black0": "rgb(0,2,1)",
445
+ "hue": 180,
446
+ "white0": "rgb(237,253,250)",
447
+ },
448
+ {
449
+ "black0": "rgb(0,2,2)",
450
+ "hue": 190,
451
+ "white0": "rgb(237,253,252)",
452
+ },
453
+ {
454
+ "black0": "rgb(0,2,2)",
455
+ "hue": 200,
456
+ "white0": "rgb(236,253,254)",
457
+ },
458
+ {
459
+ "black0": "rgb(0,2,2)",
460
+ "hue": 210,
461
+ "white0": "rgb(237,253,255)",
462
+ },
463
+ {
464
+ "black0": "rgb(0,2,3)",
465
+ "hue": 220,
466
+ "white0": "rgb(237,252,255)",
467
+ },
468
+ {
469
+ "black0": "rgb(0,1,3)",
470
+ "hue": 230,
471
+ "white0": "rgb(238,252,255)",
472
+ },
473
+ {
474
+ "black0": "rgb(0,1,3)",
475
+ "hue": 240,
476
+ "white0": "rgb(239,251,255)",
477
+ },
478
+ {
479
+ "black0": "rgb(0,1,3)",
480
+ "hue": 250,
481
+ "white0": "rgb(241,251,255)",
482
+ },
483
+ {
484
+ "black0": "rgb(0,1,4)",
485
+ "hue": 260,
486
+ "white0": "rgb(243,250,255)",
487
+ },
488
+ {
489
+ "black0": "rgb(1,1,4)",
490
+ "hue": 270,
491
+ "white0": "rgb(244,249,255)",
492
+ },
493
+ {
494
+ "black0": "rgb(1,1,4)",
495
+ "hue": 280,
496
+ "white0": "rgb(247,248,255)",
497
+ },
498
+ {
499
+ "black0": "rgb(1,1,3)",
500
+ "hue": 290,
501
+ "white0": "rgb(249,248,255)",
502
+ },
503
+ {
504
+ "black0": "rgb(1,1,3)",
505
+ "hue": 300,
506
+ "white0": "rgb(251,247,255)",
507
+ },
508
+ {
509
+ "black0": "rgb(2,1,3)",
510
+ "hue": 310,
511
+ "white0": "rgb(253,246,255)",
512
+ },
513
+ {
514
+ "black0": "rgb(2,1,2)",
515
+ "hue": 320,
516
+ "white0": "rgb(255,246,255)",
517
+ },
518
+ {
519
+ "black0": "rgb(2,1,2)",
520
+ "hue": 330,
521
+ "white0": "rgb(255,245,255)",
522
+ },
523
+ {
524
+ "black0": "rgb(3,1,2)",
525
+ "hue": 340,
526
+ "white0": "rgb(255,245,253)",
527
+ },
528
+ {
529
+ "black0": "rgb(3,0,1)",
530
+ "hue": 350,
531
+ "white0": "rgb(255,245,251)",
532
+ },
533
+ ]
534
+ `);
535
+ });
536
+ });
537
+
538
+ describe("createPalette with default config", () => {
539
+ it("should closely match default palette lightness", () => {
540
+ const defaultPalette = makeDefaultPalette();
541
+ const generatedPalette = makeThematicPalette({
542
+ baseHue: 0,
543
+ baseChroma: 0,
544
+ accentHue: 264,
545
+ accentChroma: 0.16,
546
+ });
547
+
548
+ const defaultBase = extractLightness(defaultPalette.base);
549
+ const generatedBase = extractLightness(generatedPalette.base);
550
+ const defaultBaseDark = extractLightness(defaultPalette.baseDark);
551
+ const generatedBaseDark = extractLightness(generatedPalette.baseDark);
552
+ const defaultAccent = extractLightness(defaultPalette.accent);
553
+ const generatedAccent = extractLightness(generatedPalette.accent);
554
+ const defaultAccentDark = extractLightness(defaultPalette.accentDark);
555
+ const generatedAccentDark = extractLightness(generatedPalette.accentDark);
556
+
557
+ // Allow 0.5% lightness tolerance due to color space conversion
558
+ for (let i = 0; i < 12; i++) {
559
+ expect(Math.abs(generatedBase[i] - defaultBase[i])).toBeLessThan(0.5);
560
+ expect(Math.abs(generatedBaseDark[i] - defaultBaseDark[i])).toBeLessThan(0.5);
561
+ expect(Math.abs(generatedAccent[i] - defaultAccent[i])).toBeLessThan(0.5);
562
+ expect(Math.abs(generatedAccentDark[i] - defaultAccentDark[i])).toBeLessThan(0.5);
563
+ }
564
+ });
565
+ });
566
+ });