@wordpress/theme 0.2.1-next.dc3f6d3c1.0 → 0.3.1-next.6deb34194.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.
Files changed (58) hide show
  1. package/bin/terrazzo-plugin-inline-alias-values/index.ts +43 -14
  2. package/build/color-ramps/lib/default-ramps.js +65 -65
  3. package/build/color-ramps/lib/default-ramps.js.map +1 -1
  4. package/build/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  5. package/build/color-ramps/lib/index.js.map +2 -2
  6. package/build/color-ramps/lib/taper-chroma.js +18 -44
  7. package/build/color-ramps/lib/taper-chroma.js.map +2 -2
  8. package/build/prebuilt/js/design-tokens.js +20 -9
  9. package/build/prebuilt/js/design-tokens.js.map +2 -2
  10. package/build/prebuilt/json/figma.json +125 -37
  11. package/build/theme-provider.js +3 -1
  12. package/build/theme-provider.js.map +2 -2
  13. package/build/types.js.map +1 -1
  14. package/build-module/color-ramps/lib/default-ramps.js +65 -65
  15. package/build-module/color-ramps/lib/default-ramps.js.map +1 -1
  16. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  17. package/build-module/color-ramps/lib/index.js.map +2 -2
  18. package/build-module/color-ramps/lib/taper-chroma.js +19 -46
  19. package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
  20. package/build-module/prebuilt/js/design-tokens.js +20 -9
  21. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  22. package/build-module/prebuilt/json/figma.json +125 -37
  23. package/build-module/theme-provider.js +3 -1
  24. package/build-module/theme-provider.js.map +2 -2
  25. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +3 -4
  26. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  27. package/build-types/color-ramps/lib/taper-chroma.d.ts +4 -4
  28. package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
  29. package/build-types/stories/index.story.d.ts +1 -0
  30. package/build-types/stories/index.story.d.ts.map +1 -1
  31. package/build-types/theme-provider.d.ts +1 -1
  32. package/build-types/theme-provider.d.ts.map +1 -1
  33. package/build-types/types.d.ts +8 -0
  34. package/build-types/types.d.ts.map +1 -1
  35. package/docs/ds-tokens.md +25 -14
  36. package/package.json +4 -4
  37. package/src/color-ramps/lib/default-ramps.ts +65 -65
  38. package/src/color-ramps/lib/find-color-with-constraints.ts +11 -7
  39. package/src/color-ramps/lib/index.ts +4 -4
  40. package/src/color-ramps/lib/taper-chroma.ts +32 -63
  41. package/src/prebuilt/css/design-tokens.css +84 -30
  42. package/src/prebuilt/js/design-tokens.js +20 -9
  43. package/src/prebuilt/json/figma.json +125 -37
  44. package/src/stories/index.story.tsx +23 -9
  45. package/src/theme-provider.tsx +2 -0
  46. package/src/types.ts +9 -0
  47. package/terrazzo.config.ts +21 -0
  48. package/tokens/border.json +43 -21
  49. package/tokens/color.json +65 -65
  50. package/tokens/dimension.json +106 -10
  51. package/tsconfig.bin.tsbuildinfo +1 -1
  52. package/tsconfig.src.json +1 -1
  53. package/tsconfig.src.tsbuildinfo +1 -1
  54. package/build/types/css-modules.d.js +0 -1
  55. package/build/types/css-modules.d.js.map +0 -7
  56. package/build-module/types/css-modules.d.js +0 -1
  57. package/build-module/types/css-modules.d.js.map +0 -7
  58. package/src/types/css-modules.d.ts +0 -4
@@ -40,10 +40,10 @@ export const DEFAULT_RAMPS: Record<
40
40
  bgFill1: '#3858e9',
41
41
  fgFill: '#eff0f2',
42
42
  bgFill2: '#2e49d9',
43
- surface2: '#f6f8fc',
44
- surface6: '#c7d2ee',
43
+ surface2: '#f6f8fd',
44
+ surface6: '#c7d2ed',
45
45
  surface5: '#dbe2f4',
46
- surface4: '#e4eaf7',
46
+ surface4: '#e6eaf4',
47
47
  surface3: '#fff',
48
48
  fgSurface4: '#0b0070',
49
49
  fgSurface3: '#3858e9',
@@ -51,11 +51,11 @@ export const DEFAULT_RAMPS: Record<
51
51
  fgSurface1: '#85a9ff',
52
52
  stroke3: '#3858e9',
53
53
  stroke4: '#2337c8',
54
- stroke2: '#9aaad3',
55
- stroke1: '#a2b1d6',
56
- bgFillDark: '#1b1e26',
54
+ stroke2: '#9caacc',
55
+ stroke1: '#a3b1d4',
56
+ bgFillDark: '#1a1e27',
57
57
  fgFillDark: '#eff0f2',
58
- bgFillInverted2: '#1b1e26',
58
+ bgFillInverted2: '#1a1e27',
59
59
  bgFillInverted1: '#13009f',
60
60
  fgFillInverted: '#eff0f2',
61
61
  surface1: '#ecf0f9',
@@ -65,27 +65,27 @@ export const DEFAULT_RAMPS: Record<
65
65
  info: {
66
66
  ramp: {
67
67
  bgFill1: '#0090ff',
68
- fgFill: '#1b1e23',
68
+ fgFill: '#1a1f24',
69
69
  bgFill2: '#007fed',
70
- surface2: '#f5f9fd',
71
- surface6: '#bdd5f1',
72
- surface5: '#d4e4f6',
73
- surface4: '#dfebf8',
70
+ surface2: '#f3f9ff',
71
+ surface6: '#bcd5f1',
72
+ surface5: '#d3e4f7',
73
+ surface4: '#deebfa',
74
74
  surface3: '#fff',
75
75
  fgSurface4: '#001b4f',
76
76
  fgSurface3: '#006bd7',
77
77
  fgSurface2: '#008bfa',
78
- fgSurface1: '#59b0ff',
78
+ fgSurface1: '#58b0ff',
79
79
  stroke3: '#006bd7',
80
80
  stroke4: '#004fa9',
81
- stroke2: '#94b5d9',
82
- stroke1: '#9fbcdd',
83
- bgFillDark: '#1b1e23',
84
- fgFillDark: '#eff0f2',
85
- bgFillInverted2: '#1b1e23',
81
+ stroke2: '#95b5d9',
82
+ stroke1: '#9fbcdc',
83
+ bgFillDark: '#1a1f24',
84
+ fgFillDark: '#eef0f3',
85
+ bgFillInverted2: '#1a1f24',
86
86
  bgFillInverted1: '#002a69',
87
- fgFillInverted: '#eff0f2',
88
- surface1: '#e9f1fa',
87
+ fgFillInverted: '#eef0f3',
88
+ surface1: '#e4f1ff',
89
89
  },
90
90
  direction: 'darker',
91
91
  },
@@ -94,25 +94,25 @@ export const DEFAULT_RAMPS: Record<
94
94
  bgFill1: '#4ab866',
95
95
  fgFill: '#1b1f1c',
96
96
  bgFill2: '#37a756',
97
- surface2: '#f0fcf2',
98
- surface6: '#7eea95',
99
- surface5: '#b5f1bf',
100
- surface4: '#cbf5d1',
97
+ surface2: '#eaffed',
98
+ surface6: '#88e89b',
99
+ surface5: '#aff3bb',
100
+ surface4: '#c5f7cc',
101
101
  surface3: '#fff',
102
102
  fgSurface4: '#002900',
103
103
  fgSurface3: '#007f30',
104
104
  fgSurface2: '#2b9e4e',
105
- fgSurface1: '#53c06e',
105
+ fgSurface1: '#53c16e',
106
106
  stroke3: '#007f30',
107
107
  stroke4: '#006013',
108
- stroke2: '#7dc189',
109
- stroke1: '#82c98f',
108
+ stroke2: '#84c08e',
109
+ stroke1: '#8ac894',
110
110
  bgFillDark: '#1b1f1c',
111
- fgFillDark: '#edf2ed',
111
+ fgFillDark: '#eaf3eb',
112
112
  bgFillInverted2: '#1b1f1c',
113
113
  bgFillInverted1: '#003701',
114
- fgFillInverted: '#edf2ed',
115
- surface1: '#dbf8df',
114
+ fgFillInverted: '#eaf3eb',
115
+ surface1: '#cbfdd2',
116
116
  },
117
117
  direction: 'darker',
118
118
  },
@@ -121,25 +121,25 @@ export const DEFAULT_RAMPS: Record<
121
121
  bgFill1: '#f0d149',
122
122
  fgFill: '#1f1e1b',
123
123
  bgFill2: '#dcbe2f',
124
- surface2: '#fdf9e7',
125
- surface6: '#ecd264',
126
- surface5: '#f5e297',
127
- surface4: '#f7eab3',
124
+ surface2: '#fff9c9',
125
+ surface6: '#e8d172',
126
+ surface5: '#f7e18a',
127
+ surface4: '#fee994',
128
128
  surface3: '#fff',
129
129
  fgSurface4: '#281d00',
130
- fgSurface3: '#836b00',
131
- fgSurface2: '#a58700',
132
- fgSurface1: '#c7a900',
133
- stroke3: '#836b00',
134
- stroke4: '#635000',
135
- stroke2: '#bfb17a',
136
- stroke1: '#c7b97f',
130
+ fgSurface3: '#826a00',
131
+ fgSurface2: '#a48600',
132
+ fgSurface1: '#c6a800',
133
+ stroke3: '#826a00',
134
+ stroke4: '#624f00',
135
+ stroke2: '#bdb17e',
136
+ stroke1: '#c5b883',
137
137
  bgFillDark: '#1f1e1b',
138
- fgFillDark: '#f6f1da',
138
+ fgFillDark: '#fdf1bf',
139
139
  bgFillInverted2: '#1f1e1b',
140
140
  bgFillInverted1: '#392c00',
141
- fgFillInverted: '#f6f1da',
142
- surface1: '#f9f0c8',
141
+ fgFillInverted: '#fdf1bf',
142
+ surface1: '#ffef9b',
143
143
  },
144
144
  direction: 'darker',
145
145
  },
@@ -148,25 +148,25 @@ export const DEFAULT_RAMPS: Record<
148
148
  bgFill1: '#f0b849',
149
149
  fgFill: '#1f1e1b',
150
150
  bgFill2: '#dda633',
151
- surface2: '#fdf7ee',
152
- surface6: '#f1ce8f',
153
- surface5: '#f6e0b9',
154
- surface4: '#f8e8cc',
151
+ surface2: '#fff7e0',
152
+ surface6: '#f4cc84',
153
+ surface5: '#faddac',
154
+ surface4: '#fde6bd',
155
155
  surface3: '#fff',
156
156
  fgSurface4: '#2e1900',
157
- fgSurface3: '#936400',
158
- fgSurface2: '#b68000',
159
- fgSurface1: '#d8a12c',
160
- stroke3: '#936400',
161
- stroke4: '#704a00',
162
- stroke2: '#caae7c',
163
- stroke1: '#d2b581',
157
+ fgSurface3: '#926300',
158
+ fgSurface2: '#b47f00',
159
+ fgSurface1: '#d7a02a',
160
+ stroke3: '#926300',
161
+ stroke4: '#6f4900',
162
+ stroke2: '#c7ad7e',
163
+ stroke1: '#d0b381',
164
164
  bgFillDark: '#1f1e1b',
165
- fgFillDark: '#f3f0e9',
165
+ fgFillDark: '#f7efe2',
166
166
  bgFillInverted2: '#1f1e1b',
167
167
  bgFillInverted1: '#422800',
168
- fgFillInverted: '#f3f0e9',
169
- surface1: '#faeeda',
168
+ fgFillInverted: '#f7efe2',
169
+ surface1: '#ffecc4',
170
170
  },
171
171
  direction: 'darker',
172
172
  },
@@ -175,10 +175,10 @@ export const DEFAULT_RAMPS: Record<
175
175
  bgFill1: '#cc1818',
176
176
  fgFill: '#f2efef',
177
177
  bgFill2: '#b90000',
178
- surface2: '#fdf6f5',
179
- surface6: '#f5c8c1',
180
- surface5: '#f9dbd7',
181
- surface4: '#fae4e1',
178
+ surface2: '#fff6f4',
179
+ surface6: '#f3c8c2',
180
+ surface5: '#f8dcd7',
181
+ surface4: '#f6e6e3',
182
182
  surface3: '#fff',
183
183
  fgSurface4: '#470000',
184
184
  fgSurface3: '#cc1818',
@@ -186,14 +186,14 @@ export const DEFAULT_RAMPS: Record<
186
186
  fgSurface1: '#ff8879',
187
187
  stroke3: '#cc1818',
188
188
  stroke4: '#9d0000',
189
- stroke2: '#de988e',
190
- stroke1: '#e1a198',
189
+ stroke2: '#d39c95',
190
+ stroke1: '#daa39b',
191
191
  bgFillDark: '#231c1b',
192
192
  fgFillDark: '#f2efef',
193
193
  bgFillInverted2: '#231c1b',
194
194
  bgFillInverted1: '#640000',
195
195
  fgFillInverted: '#f2efef',
196
- surface1: '#fbece9',
196
+ surface1: '#fcece9',
197
197
  },
198
198
  direction: 'darker',
199
199
  },
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, OKLCH, type ColorTypes } from 'colorjs.io/fn';
4
+ import { get, OKLCH, type PlainColorObject } from 'colorjs.io/fn';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -28,7 +28,6 @@ function cdiff( c1: number, c2: number ) {
28
28
  * - the L applied to the seed meets the contrast target against the reference
29
29
  * - the search is performed in one direction (ie lighter / darker)
30
30
  * - more constraints can be applied around lightness
31
- * - chroma could be tapered
32
31
  * @param reference
33
32
  * @param seed
34
33
  * @param target
@@ -40,8 +39,8 @@ function cdiff( c1: number, c2: number ) {
40
39
  * @param options.taperChromaOptions
41
40
  */
42
41
  export function findColorMeetingRequirements(
43
- reference: ColorTypes,
44
- seed: ColorTypes,
42
+ reference: PlainColorObject,
43
+ seed: PlainColorObject,
45
44
  target: number,
46
45
  direction: 'lighter' | 'darker',
47
46
  {
@@ -54,7 +53,12 @@ export function findColorMeetingRequirements(
54
53
  };
55
54
  taperChromaOptions?: TaperChromaOptions;
56
55
  } = {}
57
- ): { color: ColorTypes; reached: boolean; achieved: number; deficit?: number } {
56
+ ): {
57
+ color: PlainColorObject;
58
+ reached: boolean;
59
+ achieved: number;
60
+ deficit?: number;
61
+ } {
58
62
  // A target of 1 means same color.
59
63
  // A target lower than 1 doesn't make sense.
60
64
  if ( target <= 1 ) {
@@ -65,7 +69,7 @@ export function findColorMeetingRequirements(
65
69
  };
66
70
  }
67
71
 
68
- function getColorForL( l: number ): ColorTypes {
72
+ function getColorForL( l: number ): PlainColorObject {
69
73
  let newL = l;
70
74
  let newC = get( seed, [ OKLCH, 'c' ] );
71
75
 
@@ -140,7 +144,7 @@ export function findColorMeetingRequirements(
140
144
 
141
145
  const bestColor = solveWithBisect(
142
146
  getColorForL,
143
- ( c: ColorTypes ) => cdiff( getContrast( reference, c ), target ),
147
+ ( c ) => cdiff( getContrast( reference, c ), target ),
144
148
  lowerL,
145
149
  lowerContrast,
146
150
  upperL,
@@ -56,7 +56,7 @@ function calculateRamp( {
56
56
  oppDir,
57
57
  pinLightness,
58
58
  }: {
59
- seed: ColorTypes;
59
+ seed: PlainColorObject;
60
60
  sortedSteps: ( keyof Ramp )[];
61
61
  config: RampConfig;
62
62
  mainDir: RampDirection;
@@ -74,7 +74,7 @@ function calculateRamp( {
74
74
 
75
75
  // Keep track of the calculated colors, as they are going to be useful
76
76
  // when other colors reference them.
77
- const calculatedColors = new Map< keyof Ramp | 'seed', ColorTypes >();
77
+ const calculatedColors = new Map< keyof Ramp | 'seed', PlainColorObject >();
78
78
  calculatedColors.set( 'seed', seed );
79
79
 
80
80
  for ( const stepName of sortedSteps ) {
@@ -267,11 +267,11 @@ export function buildRamp(
267
267
  if ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {
268
268
  const iterSteps = stepsForStep( maxDeficitStep!, config );
269
269
 
270
- function getSeedForL( l: number ): ColorTypes {
270
+ function getSeedForL( l: number ): PlainColorObject {
271
271
  return clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );
272
272
  }
273
273
 
274
- function getDeficitForSeed( s: ColorTypes ): number {
274
+ function getDeficitForSeed( s: PlainColorObject ): number {
275
275
  const iterationResults = calculateRamp( {
276
276
  seed: s,
277
277
  sortedSteps: iterSteps,
@@ -3,12 +3,11 @@
3
3
  */
4
4
  import {
5
5
  get,
6
- inGamut,
6
+ toGamut,
7
7
  OKLCH,
8
- P3,
9
8
  sRGB,
10
- type ColorTypes,
11
- type ColorObject,
9
+ type PlainColorObject,
10
+ type ColorSpace,
12
11
  } from 'colorjs.io/fn';
13
12
 
14
13
  /**
@@ -17,7 +16,7 @@ import {
17
16
  import './register-color-spaces';
18
17
 
19
18
  export interface TaperChromaOptions {
20
- gamut?: 'p3' | 'srgb'; // target gamut (default "p3")
19
+ gamut?: ColorSpace; // target gamut (default `sRGB`)
21
20
  alpha?: number; // base fraction of Cmax at target (default 0.62)
22
21
  carry?: number; // seed vividness carry exponent β in [0..1] (default 0.5)
23
22
  cUpperBound?: number; // hard search cap for C (default 0.45)
@@ -41,12 +40,11 @@ export interface TaperChromaOptions {
41
40
  * @param options
42
41
  */
43
42
  export function taperChroma(
44
- seed: ColorTypes, // already OKLCH
43
+ seed: PlainColorObject, // already OKLCH
45
44
  lTarget: number, // [0..1]
46
45
  options: TaperChromaOptions = {}
47
- ): { l: number; c: number } | ColorObject {
48
- const gamut = options.gamut ?? 'p3';
49
- const gamutSpace = gamut === 'p3' ? P3 : sRGB;
46
+ ): { l: number; c: number } | PlainColorObject {
47
+ const gamut = options.gamut ?? sRGB;
50
48
  const alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface
51
49
  const carry = options.carry ?? 0.5;
52
50
  const cUpperBound = options.cUpperBound ?? 0.45;
@@ -68,24 +66,20 @@ export function taperChroma(
68
66
  } else {
69
67
  // Respect achromatic intent: grayscale at target L
70
68
  return {
71
- spaceId: 'oklch',
69
+ space: OKLCH,
72
70
  coords: [ clamp01( lTarget ), 0, 0 ],
71
+ alpha: 1,
73
72
  };
74
73
  }
75
74
  }
76
75
 
77
76
  // Capacity at seed and target
78
77
  const lSeed = clamp01( get( seed, [ OKLCH, 'l' ] ) );
79
- const cmaxSeed = getCachedMaxChromaAtLH(
80
- lSeed,
81
- hSeed,
82
- gamutSpace,
83
- cUpperBound
84
- );
78
+ const cmaxSeed = getCachedMaxChromaAtLH( lSeed, hSeed, gamut, cUpperBound );
85
79
  const cmaxTarget = getCachedMaxChromaAtLH(
86
80
  clamp01( lTarget ),
87
81
  hSeed,
88
- gamutSpace,
82
+ gamut,
89
83
  cUpperBound
90
84
  );
91
85
 
@@ -106,20 +100,10 @@ export function taperChroma(
106
100
  kLight,
107
101
  kDark,
108
102
  } );
109
- let cPlanned = cWithCarry * t;
103
+ const cPlanned = cWithCarry * t;
110
104
 
111
105
  // Downward-only clamp (preserve L & H)
112
106
  const lOut = clamp01( lTarget );
113
- const candidate: ColorTypes = {
114
- spaceId: 'oklch',
115
- coords: [ lOut, cPlanned, hSeed ],
116
- };
117
- if ( ! inGamut( candidate, gamutSpace ) ) {
118
- const cap = Math.min( cPlanned, cUpperBound );
119
- cPlanned = getCachedMaxChromaAtLH( lOut, hSeed, gamutSpace, cap );
120
- }
121
-
122
- cPlanned = Math.min( cPlanned, cSeed );
123
107
 
124
108
  return { l: lOut, c: cPlanned };
125
109
  }
@@ -181,19 +165,14 @@ function continuousTaper(
181
165
  /* ---- chroma-capacity queries with small caches ---- */
182
166
 
183
167
  const maxChromaCache = new Map< string, number >();
184
-
185
- function keyMax(
186
- l: number,
187
- h: number,
188
- gamut: 'p3' | 'srgb',
189
- cap: number
190
- ): string {
168
+ function keyMax( l: number, h: number, gamut: string, cap: number ): string {
191
169
  // Quantize to keep cache compact
192
- const lq = quantize( l, 1e-3 );
193
- const hq = quantize( normalizeHue( h ), 1e-1 );
194
- const cq = quantize( cap, 1e-3 );
170
+ const lq = quantize( l, 0.05 );
171
+ const hq = quantize( normalizeHue( h ), 10 );
172
+ const cq = quantize( cap, 0.05 );
195
173
  return `${ gamut }|L:${ lq }|H:${ hq }|cap:${ cq }`;
196
174
  }
175
+
197
176
  function quantize( x: number, step: number ): number {
198
177
  const k = Math.round( x / step );
199
178
  return k * step;
@@ -202,10 +181,10 @@ function quantize( x: number, step: number ): number {
202
181
  function getCachedMaxChromaAtLH(
203
182
  l: number,
204
183
  h: number,
205
- gamutSpace: typeof P3 | typeof sRGB,
184
+ gamutSpace: ColorSpace,
206
185
  cap: number
207
186
  ): number {
208
- const gamut = gamutSpace === P3 ? 'p3' : 'srgb';
187
+ const gamut = gamutSpace.id;
209
188
  const key = keyMax( l, h, gamut, cap );
210
189
  const hit = maxChromaCache.get( key );
211
190
  if ( typeof hit === 'number' ) {
@@ -218,7 +197,7 @@ function getCachedMaxChromaAtLH(
218
197
  }
219
198
 
220
199
  /**
221
- * Binary-search the max in-gamut chroma at fixed (L,H) in the target gamut
200
+ * Find the max in-gamut chroma at fixed (L,H) in the target gamut
222
201
  * @param l
223
202
  * @param h
224
203
  * @param gamutSpace
@@ -227,28 +206,18 @@ function getCachedMaxChromaAtLH(
227
206
  function maxInGamutChromaAtLH(
228
207
  l: number,
229
208
  h: number,
230
- gamutSpace: typeof P3 | typeof sRGB,
209
+ gamutSpace: ColorSpace,
231
210
  cap: number
232
211
  ): number {
233
- let lo = 0;
234
- let hi = cap;
235
- let ok = 0;
236
-
237
- const lFixed = clamp01( l );
238
- const hFixed = normalizeHue( h );
239
-
240
- for ( let i = 0; i < 18; i++ ) {
241
- const mid = ( lo + hi ) / 2;
242
- const probe: ColorTypes = {
243
- spaceId: 'oklch',
244
- coords: [ lFixed, mid, hFixed ],
245
- };
246
- if ( inGamut( probe, gamutSpace ) ) {
247
- ok = mid;
248
- lo = mid;
249
- } else {
250
- hi = mid;
251
- }
252
- }
253
- return ok;
212
+ // Construct a color with maximum chroma.
213
+ const probe: PlainColorObject = {
214
+ space: OKLCH,
215
+ coords: [ l, cap, h ],
216
+ alpha: 1,
217
+ };
218
+
219
+ // Let `toGamut` reduce the chroma to the gamut maximum.
220
+ const clamped = toGamut( probe, { space: gamutSpace, method: 'css' } );
221
+
222
+ return get( clamped, [ OKLCH, 'c' ] );
254
223
  }