@adea-ai/themes 0.9.8 → 0.9.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.
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA+B5D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAuB,MAAM,CAAC,MAAM,CAAC;IACjE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE;IACxE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE;IAC9E,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,SAAS,EAAE;IAClF,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE;IACrE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE;IAC7E,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,SAAS,EAAE;IAC/E,EA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2
  "name": "@adea-ai/themes",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "description": "The Adea theme catalogue: first-party and imported semantic OKLCH themes, with Base24, terminal, CSS and syntax adapters.",
5
5
  "keywords": [
6
6
  "adea",
@@ -111,13 +111,13 @@
111
111
  "devDependencies": {
112
112
  "@types/node": "^26.6.4",
113
113
  "bun-types": "^1.4.2",
114
- "code-foundry": "1.44.3",
115
- "oxfmt": "^0.71.0",
116
- "oxlint": "^1.86.0",
114
+ "code-foundry": "1.44.11",
115
+ "oxfmt": "^0.72.0",
116
+ "oxlint": "^1.87.0",
117
117
  "typescript": "^7.0.2"
118
118
  },
119
119
  "engines": {
120
120
  "node": "24.21.0"
121
121
  },
122
- "packageManager": "bun@1.4.0"
122
+ "packageManager": "bun@1.4.2"
123
123
  }
package/src/accents.ts CHANGED
@@ -42,17 +42,45 @@
42
42
  * A uniform step needs a resolved value, which is why {@link primaryHover} returns
43
43
  * one and why the tint below can stay an expression. `shiftLightness` is what keeps
44
44
  * the step uniform *and* the hue intact — a mix toward a neutral cannot do both.
45
+ *
46
+ * ## The tint rule
47
+ *
48
+ * The tint is the selected state across the component library — `bg-primary-subtle
49
+ * text-foreground` on an active nav row, a pressed toggle, the highlighted command
50
+ * row, a selected tab — so body text on it is held to the body floor, on every
51
+ * surface body text is held to it on, for every accent the theme offers.
52
+ *
53
+ * It stays a translucent `color-mix()` rather than becoming an opaque value, and
54
+ * that is a measured choice rather than a habit. An opaque tint mixed into the
55
+ * canvas is legible everywhere by construction — the status `-subtle` fills work
56
+ * that way — but it is a wash *of the canvas*: on a dark theme's popover, which is
57
+ * already lighter than the canvas, a selected command row resolved that way lands
58
+ * within ΔE 0.01 of the popover and disappears. A translucent tint is a wash of
59
+ * whatever it sits on, so it reads as selected on every rung.
60
+ *
61
+ * What moves instead is the **strength**, per theme. {@link ACCENT_SUBTLE_ALPHA} is
62
+ * the ceiling, and {@link primarySubtleAlpha} lowers it — only as far as a theme
63
+ * needs — until the composite clears the floor everywhere. The palettes whose body
64
+ * text sits closest to the floor get a lighter wash, and the colour, the
65
+ * foreground and the surfaces stay exactly as their authors wrote them.
45
66
  */
46
67
 
47
- import type { AdeaTheme, AnsiKey, ThemeAppearance } from './schema.js'
68
+ import type { AdeaTheme, AnsiKey, ShadcnThemeProjection, ThemeAppearance } from './schema.js'
48
69
  import type { Oklch } from './oklch.js'
49
- import { contrastRatio, formatOklch, parseColor, shiftLightness } from './oklch.js'
70
+ import {
71
+ contrastRatio,
72
+ formatOklch,
73
+ hexToOklch,
74
+ oklchToHex,
75
+ parseColor,
76
+ shiftLightness,
77
+ } from './oklch.js'
50
78
  import {
51
79
  ACCENT_PREFERENCE,
52
80
  CONTRAST_FLOORS,
53
81
  MINIMUM_ACCENT_CHROMA,
54
82
  REPAIR_BUDGET,
55
- } from './normalize.js'
83
+ } from './policy.js'
56
84
 
57
85
  /** One accent preset: a named primary, per appearance. */
58
86
  export type AccentPreset = {
@@ -195,12 +223,16 @@ export function primaryHover(primary: string, appearance: ThemeAppearance): stri
195
223
  }
196
224
 
197
225
  /**
198
- * How much of the primary a tint carries, per appearance.
226
+ * How much of the primary a tint carries at most, per appearance.
199
227
  *
200
228
  * Not one value, because a tint's visibility depends on what it is tinted onto: the
201
229
  * same alpha over a near-black surface reads as nothing, and over a near-white one
202
230
  * reads as a wash. The dark value is the larger for exactly that reason.
203
231
  *
232
+ * A **ceiling**, not the value every theme gets: {@link primarySubtleAlpha} lowers
233
+ * it for a theme whose body text cannot hold the floor on a tint this strong. Most
234
+ * themes keep it.
235
+ *
204
236
  * This one *is* a `color-mix()`, because a tint is a share of the primary by nature
205
237
  * and follows `--primary` correctly at runtime.
206
238
  */
@@ -209,17 +241,180 @@ export const ACCENT_SUBTLE_ALPHA: Readonly<Record<ThemeAppearance, number>> = Ob
209
241
  dark: 16,
210
242
  })
211
243
 
244
+ /** A theme, with the presentation surfaces the shadcn bridge may substitute. */
245
+ type TintedTheme = Pick<AdeaTheme, 'appearance' | 'colors' | 'ansi'> & {
246
+ shadcn?: ShadcnThemeProjection
247
+ }
248
+
249
+ /**
250
+ * The weakest tint the catalogue will ship, as a whole percentage.
251
+ *
252
+ * {@link primarySubtleAlpha} lowers a theme's strength for legibility, and this is
253
+ * how far it may go: below it the selected state stops reading as a state at all.
254
+ * The normalizer reserves it — it fits a theme's hover rung so body text still
255
+ * clears the floor under a tint this strong — so every theme in the catalogue can
256
+ * carry at least this much. At 4% the tint over One Dark's popover measures ΔE 0.018
257
+ * against the popover, about the same as its hover rung's feedback there.
258
+ */
259
+ export const ACCENT_SUBTLE_MINIMUM_ALPHA = 4
260
+
261
+ /**
262
+ * Every surface the tint is guaranteed on: every surface body text is guaranteed
263
+ * on.
264
+ *
265
+ * The canvas, the two raised rungs and the hover rung, plus whatever a source
266
+ * substitutes for them in the shadcn bridge — `--card`, `--popover`, `--muted` and
267
+ * `--secondary`; `--sidebar` is the first rung and `--accent` the hover rung. The
268
+ * hover rung is here because a selected item that is also hovered paints the tint
269
+ * over it in some components. The active rung is not: it is the pressed state of an
270
+ * item, not a surface an item sits on.
271
+ */
272
+ function tintSurfaces(theme: TintedTheme): string[] {
273
+ const shadcn = theme.shadcn ?? {}
274
+ return [
275
+ ...new Set([
276
+ theme.colors.background,
277
+ theme.colors.surface,
278
+ theme.colors.surfaceElevated,
279
+ theme.colors.surfaceHover,
280
+ ...[shadcn.card, shadcn.popover, shadcn.muted, shadcn.secondary].filter(
281
+ (value): value is string => value !== undefined
282
+ ),
283
+ ]),
284
+ ]
285
+ }
286
+
287
+ /**
288
+ * The primaries a theme offers: its own accent, the {@link ACCENTS} presets in its
289
+ * appearance, and every palette slot {@link themeAccentPresets} could offer from it
290
+ * whatever theme it is paired with.
291
+ */
292
+ function offeredPrimaries(theme: TintedTheme): string[] {
293
+ const slots = ACCENT_PREFERENCE.map((slot) => offeredSlotValue(theme, slot)).filter(
294
+ (value): value is string => value !== undefined
295
+ )
296
+ return [
297
+ ...new Set([
298
+ theme.colors.accent,
299
+ ...ACCENTS.map((preset) => accentValue(preset, theme.appearance)),
300
+ ...slots,
301
+ ]),
302
+ ]
303
+ }
304
+
305
+ /** A colour as the screen draws it: through eight-bit sRGB. */
306
+ function rendered(value: string): Oklch | undefined {
307
+ const parsed = parseColor(value)
308
+ return parsed ? hexToOklch(oklchToHex(parsed)) : undefined
309
+ }
310
+
311
+ /**
312
+ * A translucent fill painted over an opaque one, the way a browser paints
313
+ * `color-mix(in oklch, <tint> N%, transparent)`: the mix keeps the tint's colour and
314
+ * takes the share as alpha, and the alpha is composited in gamma-encoded sRGB.
315
+ * Rounded to the eight-bit value that reaches the screen, which is the colour an
316
+ * accessibility audit samples.
317
+ */
318
+ function compositeTint(tint: string, surface: string, alpha: number): Oklch | undefined {
319
+ const tintColor = parseColor(tint)
320
+ const surfaceColor = parseColor(surface)
321
+ if (!tintColor || !surfaceColor) return undefined
322
+ const front = oklchToHex(tintColor)
323
+ const back = oklchToHex(surfaceColor)
324
+ const channels = [1, 3, 5].map((offset) => {
325
+ const top = Number.parseInt(front.slice(offset, offset + 2), 16)
326
+ const bottom = Number.parseInt(back.slice(offset, offset + 2), 16)
327
+ return Math.round(top * alpha + bottom * (1 - alpha))
328
+ .toString(16)
329
+ .padStart(2, '0')
330
+ })
331
+ return hexToOklch(`#${channels.join('')}`)
332
+ }
333
+
334
+ /**
335
+ * Whether body text holds the floor on a surface under the primary tint.
336
+ *
337
+ * True when `text` and `foreground` both clear `CONTRAST_FLOORS.text` on the tint
338
+ * at `alpha` percent composited over `surface`, for every primary the theme offers
339
+ * and every one in `primaries`. At `alpha` 0 it is the bare surface. The
340
+ * normalizer calls this to fit the hover rung, and {@link primarySubtleAlpha} to
341
+ * fit the strength, so the two are measured by one rule.
342
+ */
343
+ export function primaryTintClears(
344
+ theme: TintedTheme,
345
+ surface: string,
346
+ alpha: number,
347
+ primaries: readonly string[] = []
348
+ ): boolean {
349
+ const foregrounds = [...new Set([theme.colors.text, theme.colors.foreground])].map(rendered)
350
+ if (foregrounds.some((value) => value === undefined)) return false
351
+ const tints = alpha === 0 ? [surface] : [...new Set([...offeredPrimaries(theme), ...primaries])]
352
+ return tints.every((tint) => {
353
+ const fill = compositeTint(tint, surface, alpha / 100)
354
+ return (
355
+ fill !== undefined &&
356
+ foregrounds.every((foreground) => contrastRatio(foreground!, fill) >= CONTRAST_FLOORS.text)
357
+ )
358
+ })
359
+ }
360
+
361
+ const subtleAlphaCache = new WeakMap<object, number>()
362
+
363
+ /**
364
+ * The tint strength a theme can carry, as a whole percentage.
365
+ *
366
+ * The appearance's {@link ACCENT_SUBTLE_ALPHA} ceiling, lowered one point at a time
367
+ * until body text clears `CONTRAST_FLOORS.text` on the tint over every floored
368
+ * surface, hover rung included, for every primary the theme offers. One value per
369
+ * theme rather than one per accent, so switching between offered accents at runtime
370
+ * needs no new tint: the expression follows `--primary` and the strength already
371
+ * holds for all of them. Every catalogue theme lands at or above
372
+ * {@link ACCENT_SUBTLE_MINIMUM_ALPHA}, because the normalizer fits its hover rung to
373
+ * leave room for it.
374
+ *
375
+ * Pass `primaries` to hold the strength for colours outside the offered set too —
376
+ * a product's own brand primary, say. The offered set is always included.
377
+ */
378
+ export function primarySubtleAlpha(theme: TintedTheme, primaries: readonly string[] = []): number {
379
+ const cached = primaries.length === 0 ? subtleAlphaCache.get(theme) : undefined
380
+ if (cached !== undefined) return cached
381
+
382
+ const surfaces = tintSurfaces(theme)
383
+ const clears = (alpha: number): boolean =>
384
+ surfaces.every((surface) => primaryTintClears(theme, surface, alpha, primaries))
385
+
386
+ let alpha = ACCENT_SUBTLE_ALPHA[theme.appearance]
387
+ while (alpha > 0 && !clears(alpha)) alpha -= 1
388
+
389
+ if (primaries.length === 0) subtleAlphaCache.set(theme, alpha)
390
+ return alpha
391
+ }
392
+
212
393
  /**
213
394
  * The tint expression, for any primary.
214
395
  *
215
- * Takes the appearance because the alpha is appearance-dependent — see
216
- * {@link ACCENT_SUBTLE_ALPHA}.
396
+ * Pass the **theme**: the expression then carries that theme's measured strength
397
+ * ({@link primarySubtleAlpha}) and body text on it is held to the floor for every
398
+ * accent the theme offers. It still reads `var(--primary)`, so it follows a runtime
399
+ * accent switch — but the strength is the theme's, so a consumer that applies
400
+ * themes at runtime has to write this token per theme, as it already does for
401
+ * {@link primaryHover}. A consumer whose primary is not one the theme offers passes
402
+ * it as `primaries` to have the strength measured for it as well.
403
+ *
404
+ * Passing only an **appearance** gives the {@link ACCENT_SUBTLE_ALPHA} ceiling for
405
+ * that appearance, unmeasured. That is the old behaviour and it is not legible on
406
+ * every theme — One Dark's body text on its own primary's tint over a card measures
407
+ * 4.34:1 at the dark ceiling — so it is kept for a consumer without a theme object
408
+ * in hand, not as the default to reach for.
217
409
  */
218
410
  export function primarySubtleCss(
219
- appearance: ThemeAppearance,
220
- primaryVariable = '--primary'
411
+ target: ThemeAppearance | TintedTheme,
412
+ primaryVariable = '--primary',
413
+ primaries: readonly string[] = []
221
414
  ): string {
222
- return `color-mix(in oklch, var(${primaryVariable}) ${ACCENT_SUBTLE_ALPHA[appearance]}%, transparent)`
415
+ const alpha =
416
+ typeof target === 'string' ? ACCENT_SUBTLE_ALPHA[target] : primarySubtleAlpha(target, primaries)
417
+ return `color-mix(in oklch, var(${primaryVariable}) ${alpha}%, transparent)`
223
418
  }
224
419
 
225
420
  /**
@@ -256,7 +451,10 @@ const REPAIR_STEP = 0.002
256
451
  * with a legible label. `undefined` when even the budget cannot get there, which
257
452
  * is the one case where the theme honestly cannot offer the slot.
258
453
  */
259
- function offeredSlotValue(theme: AdeaTheme, slot: ThemeAccentSlot): string | undefined {
454
+ function offeredSlotValue(
455
+ theme: Pick<AdeaTheme, 'colors' | 'ansi'>,
456
+ slot: ThemeAccentSlot
457
+ ): string | undefined {
260
458
  const original = theme.ansi[slot as AnsiKey]
261
459
  const value = parseColor(original)
262
460
  const background = parseColor(theme.colors.background)
@@ -311,10 +509,10 @@ export function themeAccentPresets(light: AdeaTheme, dark: AdeaTheme): AccentPre
311
509
  /**
312
510
  * The five declarations an accent sets, as CSS values.
313
511
  *
314
- * `primary`, `primaryForeground` and `ring` are resolved colours; `primaryHover` and
315
- * `primarySubtle` are expressions, for the reason in the module comment. A consumer
316
- * writes them as custom properties and the rules hold for every theme and every
317
- * accent at once.
512
+ * `primary`, `primaryForeground`, `primaryHover` and `ring` are resolved colours;
513
+ * `primarySubtle` is an expression, for the reason in the module comment. A
514
+ * consumer writes them as custom properties and the rules hold for every theme and
515
+ * every accent at once.
318
516
  */
319
517
  export type AccentRoles = {
320
518
  primary: string
@@ -326,10 +524,16 @@ export type AccentRoles = {
326
524
 
327
525
  export function accentRoles(
328
526
  preset: AccentPreset,
329
- appearance: ThemeAppearance,
527
+ /**
528
+ * The theme the accent is applied to, or only its appearance. A theme gives the
529
+ * tint that theme's measured strength — see {@link primarySubtleCss}; an
530
+ * appearance gives the unmeasured ceiling.
531
+ */
532
+ target: ThemeAppearance | TintedTheme,
330
533
  /** The property the subtle tint is built from. A consumer may pass its own alias. */
331
534
  primaryVariable = '--primary'
332
535
  ): AccentRoles {
536
+ const appearance = typeof target === 'string' ? target : target.appearance
333
537
  const value = accentValue(preset, appearance)
334
538
  const parsed = parseColor(value)
335
539
  const primary = parsed ? formatOklch(parsed) : value
@@ -338,7 +542,7 @@ export function accentRoles(
338
542
  primary,
339
543
  primaryForeground: accentForeground(value),
340
544
  primaryHover: primaryHover(value, appearance),
341
- primarySubtle: primarySubtleCss(appearance, primaryVariable),
545
+ primarySubtle: primarySubtleCss(target, primaryVariable),
342
546
  ring: primary,
343
547
  }
344
548
  }
@@ -201,9 +201,10 @@ export function shadcnVariables(theme: ShadcnTheme): Record<string, string> {
201
201
 
202
202
  // Keep primary states on the shared appearance-aware accent derivation. Hover is
203
203
  // resolved because its uniform lightness step cannot be expressed as a mix; the
204
- // subtle tint stays tied to --primary so it follows runtime primary overrides.
204
+ // subtle tint stays tied to --primary so it follows runtime primary overrides, at
205
+ // the strength measured for this theme so body text stays legible on it.
205
206
  variables['--primary-hover'] = primaryHover(theme.colors.accent, theme.appearance)
206
- variables['--primary-subtle'] = primarySubtleCss(theme.appearance)
207
+ variables['--primary-subtle'] = primarySubtleCss(theme)
207
208
 
208
209
  variables['--accent'] = theme.colors.surfaceHover
209
210
  variables['--accent-foreground'] = theme.colors.text
@@ -17,8 +17,8 @@ const theme: AdeaThemeRecord = {
17
17
  "foreground": "oklch(0.4899 0.0102 248.04)",
18
18
  "surface": "oklch(0.9466 0.0008 247.84)",
19
19
  "surfaceElevated": "oklch(0.9166 0.0011 247.84)",
20
- "surfaceHover": "oklch(0.8816 0.0017 247.84)",
21
- "surfaceActive": "oklch(0.8466 0.0021 247.84)",
20
+ "surfaceHover": "oklch(0.9086 0.0017 247.84)",
21
+ "surfaceActive": "oklch(0.8896 0.0021 247.84)",
22
22
  "border": "oklch(0.8316 0.0015 247.84)",
23
23
  "borderMuted": "oklch(0.8866 0.001 247.84)",
24
24
  "text": "oklch(0.4899 0.0102 248.04)",
@@ -17,8 +17,8 @@ const theme: AdeaThemeRecord = {
17
17
  "foreground": "oklch(0.7621 0.0202 262.99)",
18
18
  "surface": "oklch(0.3275 0.019 264.3)",
19
19
  "surfaceElevated": "oklch(0.3575 0.0218 264.3)",
20
- "surfaceHover": "oklch(0.3925 0.0251 264.3)",
21
- "surfaceActive": "oklch(0.4275 0.0251 264.3)",
20
+ "surfaceHover": "oklch(0.3725 0.0251 264.3)",
21
+ "surfaceActive": "oklch(0.3915 0.0251 264.3)",
22
22
  "border": "oklch(0.4425 0.0141 264.3)",
23
23
  "borderMuted": "oklch(0.3875 0.0094 264.3)",
24
24
  "text": "oklch(0.7621 0.0202 262.99)",
@@ -18,7 +18,7 @@ const theme: AdeaThemeRecord = {
18
18
  "surface": "oklch(0.9349 0.0056 71.9)",
19
19
  "surfaceElevated": "oklch(0.9049 0.0083 71.9)",
20
20
  "surfaceHover": "oklch(0.8699 0.0121 71.9)",
21
- "surfaceActive": "oklch(0.8349 0.0147 71.9)",
21
+ "surfaceActive": "oklch(0.8449 0.0147 71.9)",
22
22
  "border": "oklch(0.8199 0.0102 71.9)",
23
23
  "borderMuted": "oklch(0.8749 0.0068 71.9)",
24
24
  "text": "oklch(0.4597 0.0629 289.56)",
package/src/index.ts CHANGED
@@ -65,13 +65,16 @@ export {
65
65
  ACCENT_HOVER_STEP,
66
66
  ACCENT_IDS,
67
67
  ACCENT_SUBTLE_ALPHA,
68
+ ACCENT_SUBTLE_MINIMUM_ALPHA,
68
69
  accentForeground,
69
70
  accentForegroundContrast,
70
71
  accentRoles,
71
72
  accentValue,
72
73
  getAccent,
73
74
  primaryHover,
75
+ primarySubtleAlpha,
74
76
  primarySubtleCss,
77
+ primaryTintClears,
75
78
  themeAccentPresets,
76
79
  } from './accents.js'
77
80
 
package/src/normalize.ts CHANGED
@@ -69,64 +69,18 @@ import {
69
69
  } from './oklch.js'
70
70
  import type { ContrastRepair } from './oklch.js'
71
71
  import { repairContrast } from './oklch.js'
72
+ import { ACCENT_SUBTLE_MINIMUM_ALPHA, primaryTintClears } from './accents.js'
73
+ import {
74
+ ACCENT_PREFERENCE,
75
+ CONTRAST_FLOORS,
76
+ MINIMUM_ACCENT_CHROMA,
77
+ REPAIR_BUDGET,
78
+ } from './policy.js'
72
79
 
73
- /**
74
- * The contrast floors.
75
- *
76
- * These are the catalogue's policy, and they are the reason an external palette
77
- * can be admitted at all: nothing enters the catalogue on taste. `text` sits at
78
- * the WCAG AA body-text floor; `border` is measured on the non-text scale, where
79
- * the requirement is perceptibility rather than legibility.
80
- */
81
- export const CONTRAST_FLOORS = Object.freeze({
82
- text: 4.5,
83
- textMuted: 4.5,
84
- /** Large or non-essential text, per WCAG 1.4.3. */
85
- textSubtle: 3,
86
- accent: 4.5,
87
- /**
88
- * The accent on a raised surface, where it is a fill rather than a label.
89
- *
90
- * The same two-tier reasoning as `statusRaised`: a button or a selected tab is a
91
- * user-interface component, which WCAG holds to 3:1, and the pairing that
92
- * actually carries text — the accent's own label — is measured separately at 4.5
93
- * against the accent itself. Holding the accent to 4.5 on every surface instead
94
- * made Everforest Light's every hue collapse into its body text, because that
95
- * palette's colours are all around 2:1 on its own canvas.
96
- */
97
- accentRaised: 3,
98
- accentForeground: 4.5,
99
- /**
100
- * Status colours drawn on the canvas, where they are read as small text.
101
- */
102
- status: 4.5,
103
- /**
104
- * Status colours drawn on a raised surface, where they are an indicator.
105
- *
106
- * The two-tier policy is deliberate and it is not a relaxation for convenience.
107
- * A status role on a card is nearly always a dot, an icon or a chip's own fill —
108
- * a graphical object, which WCAG holds to 3:1 — and it is that way because the
109
- * alternative does not exist: Ayu Light and Everforest Light are muted palettes
110
- * built for a near-white canvas and neither contains a yellow that is legible as
111
- * small text on one. Forcing 4.5:1 there required blending the warning colour
112
- * 94% of the way to the body text, which produces a warning that is the same
113
- * colour as the text beside it and is therefore not a warning at all.
114
- *
115
- * A component that renders small status *text* on a raised surface should put it
116
- * on the role's `-subtle` fill, which is a tint of the canvas and is measured at
117
- * the body floor.
118
- */
119
- statusRaised: 3,
120
- /** A divider is decorative; it must be seen, not read. */
121
- border: 1.15,
122
- borderMuted: 1.08,
123
- /** A raised surface must be distinguishable from the canvas it sits on. */
124
- surface: 1.03,
125
- /** A selection must be visible under the text it selects. */
126
- selection: 1.2,
127
- } as const)
80
+ // The catalogue's policy lives in its own module so the accent axis can read it
81
+ // without importing the normalizer; it is re-exported here, where it has always been.
82
+ export { ACCENT_PREFERENCE, CONTRAST_FLOORS, MINIMUM_ACCENT_CHROMA, REPAIR_BUDGET }
128
83
 
129
- /** How far the normalizer may move a colour's lightness before it gives up. */
130
84
  /**
131
85
  * How much a repair changed the palette's colour.
132
86
  *
@@ -141,21 +95,6 @@ function distortionOf(attempt: { repair: ContrastRepair; blended: boolean }): nu
141
95
  return attempt.blended ? attempt.repair.delta * 3 : attempt.repair.delta
142
96
  }
143
97
 
144
- export const REPAIR_BUDGET = Object.freeze({
145
- /** Body text: some palettes publish a foreground that fails on their own canvas. */
146
- text: 0.2,
147
- status: 0.24,
148
- accent: 0.24,
149
- })
150
-
151
- /** The accent preference order, best first. */
152
- export const ACCENT_PREFERENCE = [
153
- 'blue',
154
- 'magenta',
155
- 'cyan',
156
- 'green',
157
- ] as const satisfies readonly AnsiKey[]
158
-
159
98
  /**
160
99
  * How much stronger body text must be than the secondary rung.
161
100
  *
@@ -165,9 +104,6 @@ export const ACCENT_PREFERENCE = [
165
104
  */
166
105
  const MINIMUM_LADDER_GAP = 0.4
167
106
 
168
- /** The smallest chroma a colour needs before it reads as "a colour" rather than grey. */
169
- export const MINIMUM_ACCENT_CHROMA = 0.035
170
-
171
107
  /** A theme's source description, as the catalogue declares it. */
172
108
  export interface ThemeSourceSpec {
173
109
  id: string
@@ -883,9 +819,11 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
883
819
  /**
884
820
  * Every surface a foreground role can be drawn on.
885
821
  *
886
- * The interaction rungs are excluded: text is not placed on a hover fill without
887
- * the component also choosing a foreground for it, and holding every role to the
888
- * furthest rung would compress the whole palette for a case that does not occur.
822
+ * The interaction rungs are excluded: holding every role to the furthest rung would
823
+ * compress the whole palette for a case that does not occur. Body text *is* drawn
824
+ * on them — a hovered or pressed row keeps its label — so once the text and the
825
+ * accent are settled the rungs are fitted to the text instead, in
826
+ * {@link fitInteractionRungs}.
889
827
  */
890
828
  const surfaces = [background, surface, surfaceElevated]
891
829
 
@@ -1185,6 +1123,8 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
1185
1123
  }
1186
1124
  }
1187
1125
 
1126
+ fitInteractionRungs(source, { appearance, colors, ansi }, background, direction, findings)
1127
+
1188
1128
  return {
1189
1129
  record: {
1190
1130
  id: source.id,
@@ -1210,6 +1150,92 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
1210
1150
  }
1211
1151
  }
1212
1152
 
1153
+ /** The resolution the interaction rungs are fitted at. */
1154
+ const RUNG_FIT_STEP = 0.001
1155
+
1156
+ /** Every fitting step from `from` down to `to`, inclusive, largest first. */
1157
+ function stepsBetween(from: number, to: number): number[] {
1158
+ const count = Math.round((from - to) / RUNG_FIT_STEP)
1159
+ return Array.from({ length: count + 1 }, (_, index) => from - index * RUNG_FIT_STEP)
1160
+ }
1161
+
1162
+ /**
1163
+ * Fits the hover and active rungs so body text stays legible on them.
1164
+ *
1165
+ * The ladder's fixed steps are what make a hover read the same in every theme, and
1166
+ * most themes keep them. But a hovered or pressed row is still a row of text, which
1167
+ * WCAG holds to the body floor like any other, and a palette whose body text sits
1168
+ * close to that floor — One Dark's foreground is 6.6:1 on its own canvas — cannot
1169
+ * afford the full step: its hover rung measured 4.45:1 and its active rung 3.86:1.
1170
+ *
1171
+ * So each rung keeps its fixed step unless body text fails on it, and then gives up
1172
+ * only as much as it must, one thousandth of lightness at a time, in the same
1173
+ * direction away from the canvas. Only lightness moves: the rung keeps the chroma
1174
+ * and hue its fixed step gave it, and the text and the canvas are untouched. The hover rung also reserves room for the primary tint at
1175
+ * `ACCENT_SUBTLE_MINIMUM_ALPHA`, because a selected row that is hovered paints the
1176
+ * tint over it; without the reservation the tint would have to fall to nothing.
1177
+ *
1178
+ * The rungs never fall below the elevated rung, so the ladder still ascends, and the
1179
+ * active rung stays beyond the hover rung wherever any step there still holds the
1180
+ * floor. A rung that cannot be fitted above the elevated rung is reported as over
1181
+ * budget, and the validator fails the theme. An authored rung is left as written.
1182
+ */
1183
+ function fitInteractionRungs(
1184
+ source: ThemeSourceSpec,
1185
+ theme: { appearance: ThemeAppearance; colors: AdeaThemeColors; ansi: AdeaAnsi },
1186
+ background: Oklch,
1187
+ direction: 1 | -1,
1188
+ findings: NormalizationFinding[]
1189
+ ): void {
1190
+ const fit = (
1191
+ role: 'surfaceHover' | 'surfaceActive',
1192
+ from: number,
1193
+ floor: number,
1194
+ holds: (rung: string) => boolean
1195
+ ): number => {
1196
+ if (source.colors?.[role] !== undefined) return from
1197
+ // Lightness only: the rung keeps the chroma and hue its fixed step gave it.
1198
+ const original = surfaceRung(background, from, direction)
1199
+ const rungAt = (step: number): string =>
1200
+ formatOklch({ ...original, l: background.l + step * direction })
1201
+ const step = stepsBetween(from, floor).find((candidate) => holds(rungAt(candidate)))
1202
+ if (step === undefined) {
1203
+ findings.push({
1204
+ themeId: source.id,
1205
+ role,
1206
+ kind: 'budget-exceeded',
1207
+ message: `body text cannot clear ${CONTRAST_FLOORS.text}:1 on the ${role} rung at any step above the elevated rung`,
1208
+ })
1209
+ return from
1210
+ }
1211
+ if (from - step > RUNG_FIT_STEP / 2) {
1212
+ theme.colors[role] = rungAt(step)
1213
+ findings.push({
1214
+ themeId: source.id,
1215
+ role,
1216
+ kind: 'repaired',
1217
+ message: `step shrunk from ${from.toFixed(3)} to ${step.toFixed(3)} so body text holds ${CONTRAST_FLOORS.text}:1 on the rung${role === 'surfaceHover' ? ` and under a ${ACCENT_SUBTLE_MINIMUM_ALPHA}% primary tint` : ''}`,
1218
+ })
1219
+ }
1220
+ return step
1221
+ }
1222
+
1223
+ const hover = fit(
1224
+ 'surfaceHover',
1225
+ SURFACE_STEPS.surfaceHover,
1226
+ SURFACE_STEPS.surfaceElevated,
1227
+ (rung) =>
1228
+ primaryTintClears(theme, rung, 0) &&
1229
+ primaryTintClears(theme, rung, ACCENT_SUBTLE_MINIMUM_ALPHA)
1230
+ )
1231
+
1232
+ // Beyond the hover rung where any step there holds the floor; level with it, which
1233
+ // does hold, where none does.
1234
+ fit('surfaceActive', SURFACE_STEPS.surfaceActive, hover, (rung) =>
1235
+ primaryTintClears(theme, rung, 0)
1236
+ )
1237
+ }
1238
+
1213
1239
  /** Parses an authored value and re-serialises it in the catalogue's notation. */
1214
1240
  function authoredColor(themeId: string, role: string, value: string): string {
1215
1241
  const parsed = parseColor(value)