@adea-ai/themes 0.11.17 → 0.11.19

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 (57) hide show
  1. package/NOTICE +11 -11
  2. package/README.md +87 -100
  3. package/dist/accents.d.ts +29 -29
  4. package/dist/accents.js +28 -28
  5. package/dist/adapters/base24.d.ts +4 -4
  6. package/dist/adapters/base24.js +5 -5
  7. package/dist/adapters/css-variables.d.ts +1 -1
  8. package/dist/adapters/css-variables.js +1 -1
  9. package/dist/adapters/css.d.ts +3 -3
  10. package/dist/adapters/css.js +3 -3
  11. package/dist/adapters/shadcn.d.ts +8 -9
  12. package/dist/adapters/shadcn.d.ts.map +1 -1
  13. package/dist/adapters/shadcn.js +10 -11
  14. package/dist/adapters/shadcn.js.map +1 -1
  15. package/dist/adapters/shiki.d.ts +3 -3
  16. package/dist/adapters/shiki.js +4 -4
  17. package/dist/adapters/xterm.d.ts +1 -1
  18. package/dist/adapters/xterm.js +1 -1
  19. package/dist/catalogue.d.ts +4 -4
  20. package/dist/catalogue.js +4 -4
  21. package/dist/derive.d.ts +10 -10
  22. package/dist/derive.js +14 -14
  23. package/dist/derive.js.map +1 -1
  24. package/dist/generated/schemes.d.ts +2 -2
  25. package/dist/generated/schemes.js +2 -2
  26. package/dist/normalize.d.ts +9 -9
  27. package/dist/normalize.js +35 -35
  28. package/dist/normalize.js.map +1 -1
  29. package/dist/oklch.d.ts +2 -2
  30. package/dist/oklch.js +6 -6
  31. package/dist/oklch.js.map +1 -1
  32. package/dist/policy.d.ts +3 -3
  33. package/dist/policy.js +3 -3
  34. package/dist/schema.d.ts +5 -5
  35. package/dist/schema.js +4 -4
  36. package/dist/sources.d.ts +9 -9
  37. package/dist/sources.js +10 -10
  38. package/dist/validate.d.ts +8 -8
  39. package/dist/validate.js +7 -7
  40. package/dist/validate.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/accents.ts +32 -32
  43. package/src/adapters/base24.ts +5 -5
  44. package/src/adapters/css-variables.ts +1 -1
  45. package/src/adapters/css.ts +3 -3
  46. package/src/adapters/shadcn.ts +10 -11
  47. package/src/adapters/shiki.ts +4 -4
  48. package/src/adapters/xterm.ts +1 -1
  49. package/src/catalogue.ts +4 -4
  50. package/src/derive.ts +14 -14
  51. package/src/generated/schemes.ts +2 -2
  52. package/src/normalize.ts +40 -40
  53. package/src/oklch.ts +6 -6
  54. package/src/policy.ts +3 -3
  55. package/src/schema.ts +5 -5
  56. package/src/sources.ts +14 -14
  57. package/src/validate.ts +9 -9
package/src/normalize.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * This module is the reason the package exists. The palettes in `palettes/` are
5
5
  * other people's, and they arrive describing a *terminal*: a background, a
6
- * foreground, a comment grey, and sixteen hues. A UI needs different words — a
6
+ * foreground, a comment grey, and sixteen hues. A UI needs different words, a
7
7
  * surface ladder, borders, an accent, four status roles that are legible as text.
8
8
  * Translating between the two is the work Adea owns, and it is done here, once,
9
9
  * for every theme in the catalogue, rather than by hand in each consumer.
@@ -13,7 +13,7 @@
13
13
  * **The surface ladder is built, not read.** Base24 has exactly one background
14
14
  * slot, so there is no upstream value to copy for "a card on the canvas". The four
15
15
  * rungs are derived by adding fixed increments to the background's OKLCH
16
- * lightness, keeping its hue and a damped share of its chroma — which is what
16
+ * lightness, keeping its hue and a damped share of its chroma, which is what
17
17
  * makes Catppuccin's ladder mauve-tinted and Nord's blue-tinted without either
18
18
  * being told to be.
19
19
  *
@@ -31,7 +31,7 @@
31
31
  * {@link buildAnsiRamp}.
32
32
  *
33
33
  * **A selection colour can erase its own text.** Base24's `base02` is whatever the
34
- * palette's author set, and several set it to a near-white — fine as a terminal
34
+ * palette's author set, and several set it to a near-white, fine as a terminal
35
35
  * selection, fatal as an app selection under near-white body text. The theme keeps
36
36
  * the palette's colour and the *adapters* derive a matching foreground
37
37
  * (see `adapters/xterm.ts`); the catalogue additionally checks that the selection
@@ -40,7 +40,7 @@
40
40
  * **Status and accent colours are repaired, within a budget.** A palette chosen for
41
41
  * an editor is not automatically legible as UI text. Every status role is checked
42
42
  * against the background and its lightness moved by the least amount that clears
43
- * the floor — and if that would move it more than the budget allows, the theme is
43
+ * the floor, and if that would move it more than the budget allows, the theme is
44
44
  * reported as failing rather than silently shipping a colour that is no longer the
45
45
  * one the palette's author chose.
46
46
  */
@@ -98,7 +98,7 @@ function distortionOf(attempt: { repair: ContrastRepair; blended: boolean }): nu
98
98
  * How much stronger body text must be than the secondary rung.
99
99
  *
100
100
  * Small on purpose. The requirement is that the two are *distinguishable*, not that
101
- * there is a wide gulf — 0.4 of a contrast ratio is a visible difference without
101
+ * there is a wide gulf, 0.4 of a contrast ratio is a visible difference without
102
102
  * making secondary text unnecessarily faint.
103
103
  */
104
104
  const MINIMUM_LADDER_GAP = 0.4
@@ -120,8 +120,8 @@ export interface ThemeSourceSpec {
120
120
  * Corrections to the vendored palette, applied before anything is derived.
121
121
  *
122
122
  * A terminal port is not always the project's own palette. Where a port has
123
- * deliberately changed a value for terminal use — iTerm2's One Dark ships a
124
- * darker canvas than Atom's editor did — the official value is the one Adea
123
+ * deliberately changed a value for terminal use, iTerm2's One Dark ships a
124
+ * darker canvas than Atom's editor did, the official value is the one Adea
125
125
  * should theme with, and the correction is recorded as a finding and documented
126
126
  * on the entry that makes it.
127
127
  */
@@ -139,13 +139,13 @@ export interface ThemeSourceSpec {
139
139
  *
140
140
  * The catalogue holds every palette to WCAG AA on every surface, which is what lets
141
141
  * it admit other people's work. The *defaults* are not other people's work: this
142
- * system holds its own themes to AAA — 7:1 — because they are what a user sees when
142
+ * system holds its own themes to AAA, 7:1, because they are what a user sees when
143
143
  * they have not chosen anything, and `packages/ui/tests/tokens.test.ts` asserts it.
144
144
  *
145
145
  * It has to be declared here rather than left to the consumer's test, because the
146
146
  * binding pair is text on a *raised* surface: Adea Light's foreground is 7.5:1 on its
147
147
  * canvas and 6.2:1 on a popover, since the light ladder descends away from the canvas.
148
- * Raising the floor rather than lowering the assertion is the point — the theme is
148
+ * Raising the floor rather than lowering the assertion is the point, the theme is
149
149
  * repaired until the claim is true, and the claim stays.
150
150
  */
151
151
  textFloor?: number
@@ -161,7 +161,7 @@ export interface ThemeSourceSpec {
161
161
  /**
162
162
  * A provenance that overrides the family's.
163
163
  *
164
- * For a theme that is not simply a member of a family — Adea's composed dark theme
164
+ * For a theme that is not simply a member of a family: Adea's composed dark theme
165
165
  * belongs to the `adea` family but has two upstream parents to name.
166
166
  */
167
167
  provenance?: ThemeProvenance
@@ -199,7 +199,7 @@ function ladderDirection(background: Oklch): 1 | -1 {
199
199
  * Chroma is scaled up slightly rather than held constant: the steps are small
200
200
  * enough that a hue carried at its original chroma reads as a grey smudge, while
201
201
  * the same hue with a little more chroma reads as "the tint this theme is made
202
- * of". The scale is modest because a surface is still a surface — at the hover
202
+ * of". The scale is modest because a surface is still a surface, at the hover
203
203
  * rung a large scale turns a panel into a coloured button.
204
204
  */
205
205
  function surfaceRung(background: Oklch, step: number, direction: 1 | -1): Oklch {
@@ -214,8 +214,8 @@ type RampRole = Exclude<AnsiKey, keyof typeof BASE24_TO_ANSI>
214
214
  /**
215
215
  * Assigns the greyscale ANSI roles.
216
216
  *
217
- * Base24 does not name `black`, `brightBlack`, `white` or `brightWhite` — the
218
- * background and foreground slots do double duty — so the mapping is Adea's, and two things about
217
+ * Base24 does not name `black`, `brightBlack`, `white` or `brightWhite`, the
218
+ * background and foreground slots do double duty, so the mapping is Adea's, and two things about
219
219
  * it are not obvious.
220
220
  *
221
221
  * **It is appearance-aware, because the ANSI greyscale ramp means opposite things
@@ -226,13 +226,13 @@ type RampRole = Exclude<AnsiKey, keyof typeof BASE24_TO_ANSI>
226
226
  * **`white` and `brightWhite` are read from different slots per appearance.** On a
227
227
  * dark theme they are the two strongest foregrounds, because that is where a dark
228
228
  * palette keeps its light colours. On a light theme the foreground ramp is
229
- * *entirely dark* — Gruvbox Light's `base05`, `base06` and `base07` are all
230
- * `#3c3836` — so reading "white" off it yields a near-black, and the light colours
229
+ * *entirely dark*: Gruvbox Light's `base05`, `base06` and `base07` are all
230
+ * `#3c3836`, so reading "white" off it yields a near-black, and the light colours
231
231
  * have to come from the two slots the palette puts *beyond* its canvas, `base10`
232
232
  * and `base11`. Where a palette leaves those darker than its canvas, the foreground
233
233
  * ramp is used instead.
234
234
  *
235
- * Candidates are de-duplicated first, because light schemes routinely set `base05`, `base06` and `base07` to the same value — without
235
+ * Candidates are de-duplicated first, because light schemes routinely set `base05`, `base06` and `base07` to the same value, without
236
236
  * de-duplication the ramp collapses to three members and the roles collide.
237
237
  */
238
238
  function buildAnsiRamp(
@@ -241,8 +241,8 @@ function buildAnsiRamp(
241
241
  appearance: ThemeAppearance
242
242
  ): Record<RampRole, Oklch> {
243
243
  // Which slots are *foregrounds* depends on the appearance, because Base24's
244
- // background slots do double duty. `base01` is the "lighter background" — a
245
- // status-bar fill — so on a dark scheme it is a usable mid grey and on a light
244
+ // background slots do double duty. `base01` is the "lighter background", a
245
+ // status-bar fill, so on a dark scheme it is a usable mid grey and on a light
246
246
  // scheme it is a second, barely-darker canvas. `base06` and `base07` are the
247
247
  // "light foreground" and "light background", and light schemes routinely set
248
248
  // `base07` to the *lightest* background, which ranks as the dimmest member of the
@@ -287,8 +287,8 @@ function buildAnsiRamp(
287
287
  // The two slots a light scheme places beyond its canvas. `base11` is one step
288
288
  // further than `base10`, which is what makes it the brighter of the pair.
289
289
  //
290
- // A canvas that is already at the top of the range — Adea's own light theme is
291
- // pure white — has nothing beyond it, so the fallback is the *brightest* end of
290
+ // A canvas that is already at the top of the range: Adea's own light theme is
291
+ // pure white, has nothing beyond it, so the fallback is the *brightest* end of
292
292
  // the foreground ramp rather than the darkest. Falling back to the dimmest would
293
293
  // hand a light theme an ANSI white darker than its own text.
294
294
  const beyondCanvas = [palette.base10, palette.base11].filter(
@@ -344,7 +344,7 @@ function emit(
344
344
  * preference order (blue first, because a blue accent is what most of these
345
345
  * palettes were designed around) and the first that clears the text floor within
346
346
  * budget, while still being *a* colour rather than a grey, wins. A family whose
347
- * identity lies elsewhere — Everforest is green, Rosé Pine is iris — declares its
347
+ * identity lies elsewhere, Everforest is green, Rosé Pine is iris, declares its
348
348
  * slot explicitly, and that declaration is honoured before any preference.
349
349
  */
350
350
  function chooseAccent(
@@ -396,14 +396,14 @@ function chooseAccent(
396
396
  if (satisfying.length > 0) {
397
397
  // A declared accent is honoured whenever it can be reached without giving the
398
398
  // colour up. Lightness movement *is* what a palette author does to make an
399
- // accent usable — Rosé Pine's iris needs a 0.11 step on its light variant and is
400
- // still unmistakably iris — so a lightness repair never costs a family its
399
+ // accent usable: Rosé Pine's iris needs a 0.11 step on its light variant and is
400
+ // still unmistakably iris, so a lightness repair never costs a family its
401
401
  // identity. Blending does: past about a third of the way the result stops being
402
402
  // the colour it came from, and a green repaired into slate is no longer
403
403
  // Everforest's accent.
404
404
  //
405
- // So the declared slot wins unless it had to be blended; if it did — or if none
406
- // was declared — the least-distorted candidate wins, with the preference order
405
+ // So the declared slot wins unless it had to be blended; if it did, or if none
406
+ // was declared, the least-distorted candidate wins, with the preference order
407
407
  // breaking ties.
408
408
  const cheapest = satisfying.reduce((best, entry) =>
409
409
  entry.distortion < best.distortion ? entry : best
@@ -544,7 +544,7 @@ function repairAcrossSurfaces(
544
544
  * toward the palette's own foreground.
545
545
  *
546
546
  * Everforest Light is why this exists. Its entire palette is muted pastels chosen
547
- * for a cream canvas, and its brightest accents measure 1.6:1 against that canvas —
547
+ * for a cream canvas, and its brightest accents measure 1.6:1 against that canvas,
548
548
  * no lightness move fixes that within a budget that leaves the colour recognisable,
549
549
  * because the colour is already as dark as its own hue allows. Darkening it further
550
550
  * produces olive.
@@ -552,7 +552,7 @@ function repairAcrossSurfaces(
552
552
  * Blending toward the palette's foreground instead is what the palette's own author
553
553
  * does when they need a colour to be read rather than seen: it keeps the hue, gives
554
554
  * up chroma, and converges on the foreground's contrast as the blend approaches 1.
555
- * The result is a muted, deeper version of the accent — which is what Everforest's
555
+ * The result is a muted, deeper version of the accent, which is what Everforest's
556
556
  * light themes actually look like.
557
557
  *
558
558
  * When even a full blend cannot clear the floor, the theme is reported rather than
@@ -675,8 +675,8 @@ const NORMAL_HUE_SLOTS = ['base08', 'base0A', 'base0B', 'base0C', 'base0D', 'bas
675
675
  * against one canvas becomes legible on another.
676
676
  *
677
677
  * This exists because a composition can put a palette's hues on somebody else's
678
- * background. GitHub's dark hues measure between 2.5:1 and 4.1:1 on a light canvas —
679
- * fine as accents, unusable as terminal text — and repairing each hue *independently*
678
+ * background. GitHub's dark hues measure between 2.5:1 and 4.1:1 on a light canvas,
679
+ * fine as accents, unusable as terminal text, and repairing each hue *independently*
680
680
  * to the floor destroys the thing that makes an ANSI palette an ANSI palette: the
681
681
  * bright variants would converge onto their normal siblings, because a bright variant
682
682
  * differs from its normal one mainly in lightness and the repair would land them all
@@ -793,7 +793,7 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
793
793
  *
794
794
  * The interaction rungs are excluded: holding every role to the furthest rung would
795
795
  * compress the whole palette for a case that does not occur. Body text *is* drawn
796
- * on them — a hovered or pressed row keeps its label — so once the text and the
796
+ * on them, a hovered or pressed row keeps its label, so once the text and the
797
797
  * accent are settled the rungs are fitted to the text instead, in
798
798
  * {@link fitInteractionRungs}.
799
799
  */
@@ -846,14 +846,14 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
846
846
  if (muted.finding) findings.push(muted.finding)
847
847
 
848
848
  /*
849
- * The ladder is derived in order — body, secondary, tertiary — and each rung is
849
+ * The ladder is derived in order, body, secondary, tertiary, and each rung is
850
850
  * held to being dimmer than the one above it.
851
851
  *
852
852
  * Sourcing the tertiary rung from `base03` is faithful to Base24, which defines that
853
853
  * slot as comments and invisibles, and for most palettes it is exactly right: the
854
854
  * value the author chose for dim text. But a few publish a `base03` that is not a dim
855
- * grey at all — Solarized's light scheme carries its near-black `base03`, Nord Light's
856
- * is a mid slate — and taking it on trust produced a *tertiary* role that was the
855
+ * grey at all: Solarized's light scheme carries its near-black `base03`, Nord Light's
856
+ * is a mid slate, and taking it on trust produced a *tertiary* role that was the
857
857
  * most prominent text on the screen, at 13.9:1 against a canvas whose body text
858
858
  * measures 5.5:1. So the slot is used when it cooperates and a blend replaces it when
859
859
  * it does not, and either way the rung is reported.
@@ -895,7 +895,7 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
895
895
  *
896
896
  * The secondary rung is repaired against the *raised* surfaces, which is the binding
897
897
  * constraint, so on a palette whose foreground is itself only a little above the floor
898
- * the repair can push secondary text past the body text — Tokyo Night Day came out
898
+ * the repair can push secondary text past the body text: Tokyo Night Day came out
899
899
  * with 5.6:1 for a caption and 5.5:1 for the paragraph, which collapses the two roles
900
900
  * into one. The fix is to give the body text room rather than to weaken the secondary
901
901
  * floor, and it is a small move: the foreground is already above its own floor, so this
@@ -925,7 +925,7 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
925
925
  /**
926
926
  * The status roles, each with fallback candidates.
927
927
  *
928
- * A palette's yellow is chosen to be *a* yellow, not to be legible as text — Ayu
928
+ * A palette's yellow is chosen to be *a* yellow, not to be legible as text: Ayu
929
929
  * Light's `#ffcc66` measures 1.9:1 on its own near-white canvas, and no amount of
930
930
  * lightness repair fixes that without turning it into olive, which is no longer
931
931
  * Ayu. So each status role has candidates and takes the first that clears the
@@ -933,7 +933,7 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
933
933
  * constants colour and in practice the warning colour this palette already uses;
934
934
  * reds and greens fall back to their bright variants.
935
935
  *
936
- * The order is not "brightest first" — on a light canvas the bright variants are
936
+ * The order is not "brightest first", on a light canvas the bright variants are
937
937
  * worse, so the declared ANSI colour is always tried before its bright sibling.
938
938
  */
939
939
  const statusCandidates = {
@@ -1013,14 +1013,14 @@ export function normalizeTheme(source: ThemeSourceSpec): NormalizedTheme {
1013
1013
  *
1014
1014
  * A composition can carry its structure donor's selection explicitly, and taking that
1015
1015
  * on trust once shipped an Adea Light selection measuring 1.11:1 against its own
1016
- * canvas — a donor's deliberately subtle selection is not the same as visible. An
1016
+ * canvas, a donor's deliberately subtle selection is not the same as visible. An
1017
1017
  * invisible selection is a functional defect rather than a matter of taste: the user
1018
1018
  * cannot see what they have selected. So the declared value is used as given and still
1019
1019
  * measured, and moving it is reported.
1020
1020
  *
1021
- * The cursor is deliberately *not* treated this way. It has no floor — a cursor is an
1021
+ * The cursor is deliberately *not* treated this way. It has no floor, a cursor is an
1022
1022
  * affordance rather than text, and several palettes in the catalogue give it a colour
1023
- * of its own — so the adapters derive a legible glyph for it instead
1023
+ * of its own, so the adapters derive a legible glyph for it instead
1024
1024
  * (see `adapters/xterm.ts`).
1025
1025
  */
1026
1026
  const declaredSelection = source.selection ? parseColor(source.selection) : undefined
@@ -1080,7 +1080,7 @@ const RUNG_FIT_STEP = 0.001
1080
1080
  * The ladder's fixed steps are what make a hover read the same in every theme, and
1081
1081
  * most themes keep them. But a hovered or pressed row is still a row of text, which
1082
1082
  * WCAG holds to the body floor like any other, and a palette whose body text sits
1083
- * close to that floor — One Dark's foreground is 6.6:1 on its own canvas — cannot
1083
+ * close to that floor, One Dark's foreground is 6.6:1 on its own canvas, cannot
1084
1084
  * afford the full step: its hover rung measured 4.45:1 and its active rung 3.86:1.
1085
1085
  *
1086
1086
  * So each rung keeps its fixed step unless body text fails on it, and then gives up
package/src/oklch.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * Two conversion directions are needed and they are not symmetric:
14
14
  *
15
15
  * - **In**, from the hex values upstream palettes publish. Lossless.
16
- * - **Out**, to hex, for consumers that cannot express OKLCH — xterm.js reads
16
+ * - **Out**, to hex, for consumers that cannot express OKLCH, xterm.js reads
17
17
  * hex, and older Shiki engines resolve hex. This direction can land outside
18
18
  * sRGB, so it gamut-maps rather than clipping.
19
19
  *
@@ -198,10 +198,10 @@ export function formatOklch(color: Oklch): string {
198
198
  * A linear channel as a renderer stores it: encoded, rounded to eight bits,
199
199
  * then back to linear light.
200
200
  *
201
- * Contrast is read off the drawing, and the drawing is three integer channels —
201
+ * Contrast is read off the drawing, and the drawing is three integer channels,
202
202
  * axe takes `rgb(127, 133, 128)` off the computed style, not the `oklch()` the
203
203
  * catalogue committed. The rounding is up to half a step per channel, and on a
204
- * dark canvas — where the denominator of a ratio is small — it moves a pairing
204
+ * dark canvas, where the denominator of a ratio is small, it moves a pairing
205
205
  * by a few hundredths: Ayu's muted text measured 4.51:1 unrounded and drew at
206
206
  * 4.48:1, under the floor it had been repaired to. This is {@link canonical}'s
207
207
  * guarantee one scale out: what is measured is what is rendered.
@@ -246,7 +246,7 @@ export function contrastDirection(foreground: Oklch, background: Oklch): 1 | -1
246
246
  *
247
247
  * Repairs must be measured against this rather than against their own working
248
248
  * value. {@link formatOklch} rounds lightness to four decimals, and rounding can
249
- * move a pairing from 4.5001:1 to 4.4998:1 — so a repair that converges on the
249
+ * move a pairing from 4.5001:1 to 4.4998:1, so a repair that converges on the
250
250
  * exact floor and is then rounded ships a value that fails the floor it was
251
251
  * computed to satisfy. Measuring the canonical form closes that gap by making the
252
252
  * thing measured and the thing committed the same thing.
@@ -292,7 +292,7 @@ export function repairContrast(
292
292
 
293
293
  // Both directions are tried, nearest first. Moving away from the background's
294
294
  // lightness is the usual answer, but when the colour is already near an end of the
295
- // range there is no headroom in that direction — Solarized Light's cursor is a
295
+ // range there is no headroom in that direction: Solarized Light's cursor is a
296
296
  // mid grey on a near-white canvas, and *lightening* it has 0.03 to work with while
297
297
  // darkening it has the whole range.
298
298
  const preferred = contrastDirection(foreground, background)
@@ -353,7 +353,7 @@ export function mix(a: Oklch, b: Oklch, amount: number): Oklch {
353
353
  export function shiftLightness(color: Oklch, delta: number): Oklch {
354
354
  const l = Math.min(1, Math.max(0, color.l + delta))
355
355
  // Chroma that was representable at the original lightness may not be at the new
356
- // one — every hue's maximum chroma collapses toward the black and white ends.
356
+ // one, every hue's maximum chroma collapses toward the black and white ends.
357
357
  // Damping before the gamut map keeps the hue from drifting as it is reduced.
358
358
  const headroom = Math.min(1, 4 * Math.min(l, 1 - l) + 0.15)
359
359
  return { l, c: color.c * headroom, h: color.h }
package/src/policy.ts CHANGED
@@ -28,7 +28,7 @@ export const CONTRAST_FLOORS = Object.freeze({
28
28
  *
29
29
  * The same two-tier reasoning as `statusRaised`: a button or a selected tab is a
30
30
  * user-interface component, which WCAG holds to 3:1, and the pairing that
31
- * actually carries text — the accent's own label — is measured separately at 4.5
31
+ * actually carries text, the accent's own label, is measured separately at 4.5
32
32
  * against the accent itself. Holding the accent to 4.5 on every surface instead
33
33
  * made Everforest Light's every hue collapse into its body text, because that
34
34
  * palette's colours are all around 2:1 on its own canvas.
@@ -43,8 +43,8 @@ export const CONTRAST_FLOORS = Object.freeze({
43
43
  * Status colours drawn on a raised surface, where they are an indicator.
44
44
  *
45
45
  * The two-tier policy is deliberate and it is not a relaxation for convenience.
46
- * A status role on a card is nearly always a dot, an icon or a chip's own fill —
47
- * a graphical object, which WCAG holds to 3:1 — and it is that way because the
46
+ * A status role on a card is nearly always a dot, an icon or a chip's own fill,
47
+ * a graphical object, which WCAG holds to 3:1, and it is that way because the
48
48
  * alternative does not exist: Ayu Light and Everforest Light are muted palettes
49
49
  * built for a near-white canvas and neither contains a yellow that is legible as
50
50
  * small text on one. Forcing 4.5:1 there required blending the warning colour
package/src/schema.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The canonical schema.
3
3
  *
4
- * This file is the contract. Everything else in the package — the normalizer, the
5
- * Base24 bridge, the terminal and editor adapters — exists to move values into or
4
+ * This file is the contract. Everything else in the package, the normalizer, the
5
+ * Base24 bridge, the terminal and editor adapters, exists to move values into or
6
6
  * out of the shapes declared here, and no adapter is allowed to invent a role that
7
7
  * is not in this file.
8
8
  *
@@ -16,8 +16,8 @@
16
16
  * authors choosing between `base01` and `base02` by eye, which is how a design
17
17
  * system acquires four nearly-identical greys that no one dares consolidate.
18
18
  *
19
- * So the roles below are the ones a component actually asks for — a surface, a
20
- * border, a muted text, an accent — and Base24 is a bridge at the edge. See
19
+ * So the roles below are the ones a component actually asks for, a surface, a
20
+ * border, a muted text, an accent, and Base24 is a bridge at the edge. See
21
21
  * `adapters/base24.ts` for both directions.
22
22
  *
23
23
  * ## Why OKLCH strings and not numbers
@@ -63,7 +63,7 @@ export interface AdeaThemeColors {
63
63
  textMuted: string
64
64
  /**
65
65
  * Tertiary text: timestamps, counts, placeholder copy. Clears 3:1, which is the
66
- * WCAG floor for large text and for non-essential text — the floor is lower
66
+ * WCAG floor for large text and for non-essential text, the floor is lower
67
67
  * here on purpose, because at 4.5:1 there is no longer any visual difference
68
68
  * between this role and `textMuted` and the role stops earning its place.
69
69
  */
package/src/sources.ts CHANGED
@@ -30,7 +30,7 @@
30
30
  * which is itself derived from `iTerm2-Color-Schemes` at a pinned revision, which
31
31
  * is where the per-family values were first published as terminal schemes. Each
32
32
  * family's official project is recorded as the design's origin, and the values were
33
- * checked against those projects' published palettes — imported backgrounds and
33
+ * checked against those projects' published palettes, imported backgrounds and
34
34
  * foregrounds match their official palettes exactly. Adea's composed and authored
35
35
  * families are asserted from their own source definitions instead.
36
36
  *
@@ -101,7 +101,7 @@ export interface ComposedSource {
101
101
  * The Base24 slot map.
102
102
  *
103
103
  * Each entry is `[donor, key]`, where the donor is `structure` or `hues` and the
104
- * key is a role name in that donor's published palette — the dataset's own names,
104
+ * key is a role name in that donor's published palette, the dataset's own names,
105
105
  * so `purple` is Base24's magenta slot and `brightPurple` its bright magenta.
106
106
  */
107
107
  slots: Readonly<Partial<Record<Base24Slot, readonly ['structure' | 'hues', string]>>>
@@ -146,7 +146,7 @@ export interface ComposedSource {
146
146
  * Transpose this composition's hues onto the borrowed canvas.
147
147
  *
148
148
  * Set when a composition takes its hues from a palette authored against a different
149
- * kind of canvas — which is what borrowing a *dark* palette's hues for a *light*
149
+ * kind of canvas, which is what borrowing a *dark* palette's hues for a *light*
150
150
  * canvas is. See `transposeHues` in `src/normalize.ts` for why the whole hue set
151
151
  * moves by one common step rather than each hue being repaired on its own.
152
152
  */
@@ -164,7 +164,7 @@ export interface ComposedSource {
164
164
  * ANSI black equal to the background is invisible as foreground text, which is the
165
165
  * defect the normalizer's ramp notes describe. On a light donor that `black` is darker
166
166
  * than the foreground, which is what an ANSI black should be on paper. Base24's bright
167
- * slots run red, yellow, green, cyan, blue, magenta — not the ANSI order of yellow
167
+ * slots run red, yellow, green, cyan, blue, magenta, not the ANSI order of yellow
168
168
  * before green.
169
169
  */
170
170
  const GITHUB_SLOTS = Object.freeze({
@@ -245,11 +245,11 @@ const RE_GREYED_DARK_CANVAS = Object.freeze({
245
245
  } as const)
246
246
 
247
247
  /**
248
- * The hue transpose for a light member, which puts GitHub's dark hues — drawn for a
249
- * `#0d1117` canvas, and between 2.5:1 and 4.1:1 on a white one — onto paper.
248
+ * The hue transpose for a light member, which puts GitHub's dark hues, drawn for a
249
+ * `#0d1117` canvas, and between 2.5:1 and 4.1:1 on a white one, onto paper.
250
250
  *
251
251
  * The target carries a margin over the floor because the step is set by the worst hue,
252
- * so without one that hue lands exactly *on* the floor — and cyan, the hue that needs
252
+ * so without one that hue lands exactly *on* the floor, and cyan, the hue that needs
253
253
  * the largest step, is also the one whose conversion to sRGB sits furthest outside the
254
254
  * gamut. A renderer that gamut-maps it by reducing chroma and one that clamps its
255
255
  * channels disagree by about 0.3 of a ratio point there, so a value on the floor
@@ -271,7 +271,7 @@ const TRANSPOSED_ONTO_PAPER = Object.freeze({ floor: CONTRAST_FLOORS.status + 0.
271
271
  *
272
272
  * The dark canvases are re-greyed (chroma halved, hue rotated to violet-grey) so the
273
273
  * family's violet accent reads against a neutral ground instead of GitHub's blue
274
- * one, and every variant's own accent is the accent slot — violet/magenta, which GitHub keeps constant across
274
+ * one, and every variant's own accent is the accent slot, violet/magenta, which GitHub keeps constant across
275
275
  * all six of its palettes, colourblind and high-contrast included.
276
276
  *
277
277
  * The accessibility variants are compositions of GitHub's own accessibility
@@ -285,8 +285,8 @@ const TRANSPOSED_ONTO_PAPER = Object.freeze({ floor: CONTRAST_FLOORS.status + 0.
285
285
  *
286
286
  * The light themes are the reason `hueTranspose` exists: GitHub's dark hues measure
287
287
  * between 2.5:1 and 4.1:1 on a light canvas, so the whole hue set is transposed down in
288
- * lightness by one common step — hue and chroma intact, relative brightness ordering
289
- * intact — rather than repaired hue by hue, which would have collapsed every bright
288
+ * lightness by one common step, hue and chroma intact, relative brightness ordering
289
+ * intact, rather than repaired hue by hue, which would have collapsed every bright
290
290
  * variant onto its normal sibling.
291
291
  */
292
292
  export const COMPOSED_SOURCES: readonly ComposedSource[] = Object.freeze([
@@ -429,7 +429,7 @@ export const COMPOSED_SOURCES: readonly ComposedSource[] = Object.freeze([
429
429
  /**
430
430
  * Per-family provenance.
431
431
  *
432
- * `url` is the project's own repository — the place its palette is defined — while
432
+ * `url` is the project's own repository, the place its palette is defined, while
433
433
  * the vendored values come through the chain described in this module's header.
434
434
  * Recording both is the point: one answers "whose palette is this", the other
435
435
  * answers "which bytes are in the file".
@@ -445,7 +445,7 @@ export const FAMILY_PROVENANCE: Readonly<Record<string, ThemeProvenance>> = Obje
445
445
  /*
446
446
  * The `github` family has no catalogue entry of its own any more: GitHub Primer's
447
447
  * palettes survive as the donors of the composed Adea variants, whose provenance
448
- * records the bootstrapping — and Primer itself is credited here by name.
448
+ * records the bootstrapping, and Primer itself is credited here by name.
449
449
  */
450
450
  catppuccin: {
451
451
  project: 'Catppuccin',
@@ -551,8 +551,8 @@ export interface VendoredSource {
551
551
  *
552
552
  * One entry uses this, and it is worth reading as the example of when it is
553
553
  * legitimate: iTerm2's One Dark port deliberately darkens the canvas to `#21252b`
554
- * so a terminal reads as a distinct surface, but Atom's own editor palette — the
555
- * thing "One Dark" means — is `hsl(220, 13%, 18%)` = `#282c34`, with comments at
554
+ * so a terminal reads as a distinct surface, but Atom's own editor palette, the
555
+ * thing "One Dark" means, is `hsl(220, 13%, 18%)` = `#282c34`, with comments at
556
556
  * `#5c6370` rather than the port's `#767676`. Adea themes an application, so the
557
557
  * project's value is the correct one. Every correction is reported as a finding
558
558
  * and appears in the catalogue's build log.
package/src/validate.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The catalogue's gate.
3
3
  *
4
- * Nothing enters this package on taste. Every theme — imported from a stranger's
5
- * palette or authored here — is measured against the same floors, and this module
4
+ * Nothing enters this package on taste. Every theme, imported from a stranger's
5
+ * palette or authored here, is measured against the same floors, and this module
6
6
  * is where that happens. It is what makes the catalogue able to accept external
7
7
  * palettes at all: a palette either clears the floors or it fails the build with
8
8
  * the pairing and the number, and a reviewer never has to decide by eye whether
@@ -23,8 +23,8 @@
23
23
  *
24
24
  * ## Why the validator is exported
25
25
  *
26
- * A consumer that adds its own theme — an application with a brand palette, or a
27
- * test that builds a theme from a design tool — needs to run the same gate. It is
26
+ * A consumer that adds its own theme, an application with a brand palette, or a
27
+ * test that builds a theme from a design tool, needs to run the same gate. It is
28
28
  * the only way to know a theme is admissible without reimplementing the rules.
29
29
  */
30
30
 
@@ -64,7 +64,7 @@ export interface Pairing {
64
64
  /**
65
65
  * Every pairing the catalogue guarantees.
66
66
  *
67
- * `textSubtle` is held to 3:1 rather than 4.5:1 — see the schema's note on it.
67
+ * `textSubtle` is held to 3:1 rather than 4.5:1, see the schema's note on it.
68
68
  * That is not a relaxation for convenience: at 4.5:1 there is no visible
69
69
  * difference between tertiary and secondary text and the role stops earning its
70
70
  * place in the schema.
@@ -126,9 +126,9 @@ export const STATUS_PAIRINGS: readonly Pairing[] = Object.freeze([
126
126
  * What is worth asserting is the pair of failures that are actually defects and are
127
127
  * invisible in a screenshot:
128
128
  *
129
- * - **Collapse** — a ramp whose roles resolve to the same colour, which means the
129
+ * - **Collapse**: a ramp whose roles resolve to the same colour, which means the
130
130
  * theme cannot express dim text at all.
131
- * - **Inversion** — an ANSI bright black no lighter than its black, in either
131
+ * - **Inversion**: an ANSI bright black no lighter than its black, in either
132
132
  * appearance.
133
133
  */
134
134
  export interface AnsiInvariant {
@@ -167,7 +167,7 @@ export function checkAnsiRamp(theme: AdeaTheme): AnsiInvariant[] {
167
167
  // and bright white roles are *foregrounds*: GitHub's light scheme, which Adea's
168
168
  // own light theme uses, sets white to a mid grey and bright white darker still,
169
169
  // and several palettes in the catalogue set the two to the same value. There is no
170
- // invariant there — unlike ANSI 0/8, whose ordering holds in both appearances.
170
+ // invariant there, unlike ANSI 0/8, whose ordering holds in both appearances.
171
171
  return findings
172
172
  }
173
173
 
@@ -225,7 +225,7 @@ function measure(theme: AdeaTheme, pairing: Pairing): ContrastFinding | undefine
225
225
  * Validates one theme.
226
226
  *
227
227
  * Returns every failure rather than the first, because a theme with three bad
228
- * pairings should be fixed in one pass — and because a palette that fails one floor
228
+ * pairings should be fixed in one pass, and because a palette that fails one floor
229
229
  * usually fails several, and seeing all of them is what shows which single value is
230
230
  * wrong.
231
231
  */