@adea-ai/themes 0.11.6 → 0.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/accents.d.ts +19 -19
- package/dist/accents.d.ts.map +1 -1
- package/dist/accents.js +45 -93
- package/dist/accents.js.map +1 -1
- package/dist/adapters/base24.d.ts +21 -12
- package/dist/adapters/base24.d.ts.map +1 -1
- package/dist/adapters/base24.js +47 -72
- package/dist/adapters/base24.js.map +1 -1
- package/dist/adapters/css-variables.d.ts +29 -0
- package/dist/adapters/css-variables.d.ts.map +1 -0
- package/dist/adapters/css-variables.js +56 -0
- package/dist/adapters/css-variables.js.map +1 -0
- package/dist/adapters/css.d.ts +2 -4
- package/dist/adapters/css.d.ts.map +1 -1
- package/dist/adapters/css.js +7 -39
- package/dist/adapters/css.js.map +1 -1
- package/dist/adapters/shadcn.d.ts +8 -4
- package/dist/adapters/shadcn.d.ts.map +1 -1
- package/dist/adapters/shadcn.js +38 -57
- package/dist/adapters/shadcn.js.map +1 -1
- package/dist/adapters/shiki.d.ts +2 -10
- package/dist/adapters/shiki.d.ts.map +1 -1
- package/dist/adapters/shiki.js +16 -29
- package/dist/adapters/shiki.js.map +1 -1
- package/dist/adapters/tailwind.d.ts +3 -3
- package/dist/adapters/tailwind.d.ts.map +1 -1
- package/dist/adapters/tailwind.js +7 -28
- package/dist/adapters/tailwind.js.map +1 -1
- package/dist/adapters/xterm.d.ts.map +1 -1
- package/dist/adapters/xterm.js +9 -21
- package/dist/adapters/xterm.js.map +1 -1
- package/dist/base24-synthesis.d.ts +31 -0
- package/dist/base24-synthesis.d.ts.map +1 -0
- package/dist/base24-synthesis.js +25 -0
- package/dist/base24-synthesis.js.map +1 -0
- package/dist/derive.d.ts +1 -1
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +11 -26
- package/dist/derive.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/normalize.d.ts +0 -8
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +105 -232
- package/dist/normalize.js.map +1 -1
- package/dist/oklch.d.ts +4 -10
- package/dist/oklch.d.ts.map +1 -1
- package/dist/oklch.js +18 -38
- package/dist/oklch.js.map +1 -1
- package/dist/policy.d.ts +14 -4
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +16 -4
- package/dist/policy.js.map +1 -1
- package/dist/render.d.ts +30 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +74 -0
- package/dist/render.js.map +1 -0
- package/dist/schema.d.ts +2 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -1
- package/dist/schema.js.map +1 -1
- package/dist/sources.d.ts +26 -33
- package/dist/sources.d.ts.map +1 -1
- package/dist/sources.js +136 -305
- package/dist/sources.js.map +1 -1
- package/dist/step-search.d.ts +10 -0
- package/dist/step-search.d.ts.map +1 -0
- package/dist/step-search.js +21 -0
- package/dist/step-search.js.map +1 -0
- package/dist/theme-token-projection-script.d.ts +2 -0
- package/dist/theme-token-projection-script.js +2 -0
- package/dist/theme-token-projection.d.ts +35 -0
- package/dist/theme-token-projection.d.ts.map +1 -0
- package/dist/theme-token-projection.js +79 -0
- package/dist/theme-token-projection.js.map +1 -0
- package/dist/validate.d.ts +12 -17
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +33 -55
- package/dist/validate.js.map +1 -1
- package/package.json +14 -4
- package/src/accents.ts +57 -96
- package/src/adapters/base24.ts +53 -75
- package/src/adapters/css-variables.ts +67 -0
- package/src/adapters/css.ts +9 -54
- package/src/adapters/shadcn.ts +34 -60
- package/src/adapters/shiki.ts +17 -30
- package/src/adapters/tailwind.ts +7 -37
- package/src/adapters/xterm.ts +9 -21
- package/src/base24-synthesis.ts +29 -0
- package/src/derive.ts +12 -27
- package/src/index.ts +6 -5
- package/src/normalize.ts +140 -267
- package/src/oklch.ts +23 -38
- package/src/policy.ts +18 -4
- package/src/render.ts +82 -0
- package/src/schema.ts +2 -1
- package/src/sources.ts +160 -330
- package/src/step-search.ts +25 -0
- package/src/theme-token-projection.ts +126 -0
- package/src/validate.ts +46 -66
package/dist/adapters/shadcn.js
CHANGED
|
@@ -23,35 +23,21 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { primaryHover, primarySubtleCss } from '../accents.js';
|
|
25
25
|
import { STATUS_ROLES, statusForeground, tint } from '../derive.js';
|
|
26
|
-
import { contrastRatio, formatOklch, gamutMap,
|
|
26
|
+
import { contrastRatio, formatOklch, gamutMap, parseColor } from '../oklch.js';
|
|
27
|
+
import { compositeOver, renderedColor } from '../render.js';
|
|
28
|
+
import { smallestOffset } from '../step-search.js';
|
|
27
29
|
const DESTRUCTIVE_PRESENTATION_FLOOR = 5;
|
|
28
30
|
const DESTRUCTIVE_HOVER_OPACITY = 0.9;
|
|
29
31
|
const DESTRUCTIVE_PRESENTATION_SURFACES = ['background', 'surface', 'surfaceElevated'];
|
|
30
|
-
function renderedColor(value) {
|
|
31
|
-
const color = parseColor(value);
|
|
32
|
-
return color ? hexToOklch(oklchToHex(color)) : undefined;
|
|
33
|
-
}
|
|
34
|
-
function compositeSrgb(foreground, background, alpha) {
|
|
35
|
-
const foregroundHex = oklchToHex(parseColor(foreground));
|
|
36
|
-
const backgroundHex = oklchToHex(parseColor(background));
|
|
37
|
-
const channels = [1, 3, 5].map((offset) => {
|
|
38
|
-
const front = Number.parseInt(foregroundHex.slice(offset, offset + 2), 16);
|
|
39
|
-
const back = Number.parseInt(backgroundHex.slice(offset, offset + 2), 16);
|
|
40
|
-
return Math.round(front * alpha + back * (1 - alpha))
|
|
41
|
-
.toString(16)
|
|
42
|
-
.padStart(2, '0');
|
|
43
|
-
});
|
|
44
|
-
return hexToOklch(`#${channels.join('')}`);
|
|
45
|
-
}
|
|
46
32
|
/**
|
|
47
33
|
* The shared destructive solid fill and foreground as rendered by the UI.
|
|
48
34
|
*
|
|
49
35
|
* A filled destructive button uses `--destructive/90` on hover. A foreground that
|
|
50
36
|
* clears the original fill can fall below AA when that color is alpha-composited
|
|
51
|
-
* over a light or dark surface.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* margin
|
|
37
|
+
* over a light or dark surface. The canonical error color is untouched; the fill
|
|
38
|
+
* differs from it only in lightness, and the foreground clears 5:1 against the fill
|
|
39
|
+
* and against its 90% composite over the canvas and both card surfaces, as eight-bit
|
|
40
|
+
* sRGB. The margin over 4.5:1 protects the AA floor from browser quantization.
|
|
55
41
|
*/
|
|
56
42
|
export function shadcnDestructiveProjection(theme) {
|
|
57
43
|
const sourceFill = parseColor(theme.colors.error);
|
|
@@ -61,7 +47,7 @@ export function shadcnDestructiveProjection(theme) {
|
|
|
61
47
|
throw new Error(`theme ${theme.id} has an invalid destructive color pair`);
|
|
62
48
|
}
|
|
63
49
|
const preferredForeground = statusForeground(theme, 'error');
|
|
64
|
-
const alternateForeground =
|
|
50
|
+
const alternateForeground = preferredForeground === formatOklch(sourceForeground)
|
|
65
51
|
? theme.colors.background
|
|
66
52
|
: theme.colors.foreground;
|
|
67
53
|
const foregrounds = [preferredForeground, alternateForeground]
|
|
@@ -78,38 +64,36 @@ export function shadcnDestructiveProjection(theme) {
|
|
|
78
64
|
if (surfaces.length !== surfaceValues.length) {
|
|
79
65
|
throw new Error(`theme ${theme.id} has an invalid destructive presentation surface`);
|
|
80
66
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
if (clearsHoverFloor)
|
|
104
|
-
return { fill, foreground: foreground.value };
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
67
|
+
let found;
|
|
68
|
+
const accepts = (offset) => {
|
|
69
|
+
const candidate = gamutMap({ ...sourceFill, l: sourceFill.l + offset });
|
|
70
|
+
if (candidate.l < 0.02 || candidate.l > 0.98)
|
|
71
|
+
return false;
|
|
72
|
+
const fill = formatOklch(candidate);
|
|
73
|
+
const renderedFill = renderedColor(fill);
|
|
74
|
+
if (!renderedFill)
|
|
75
|
+
return false;
|
|
76
|
+
const foreground = foregrounds.find(({ rendered: text }) => contrastRatio(text, renderedFill) >= DESTRUCTIVE_PRESENTATION_FLOOR &&
|
|
77
|
+
surfaces.every(({ rendered: surface }) => {
|
|
78
|
+
const composite = compositeOver(fill, formatOklch(surface), DESTRUCTIVE_HOVER_OPACITY);
|
|
79
|
+
return (composite !== undefined &&
|
|
80
|
+
contrastRatio(text, composite) >= DESTRUCTIVE_PRESENTATION_FLOOR);
|
|
81
|
+
}));
|
|
82
|
+
if (foreground)
|
|
83
|
+
found = { fill, foreground: foreground.value };
|
|
84
|
+
return foreground !== undefined;
|
|
85
|
+
};
|
|
86
|
+
if (accepts(0) || smallestOffset(0.001, 250, [-1, 1], accepts) !== undefined)
|
|
87
|
+
return found;
|
|
108
88
|
throw new Error(`theme ${theme.id} cannot meet the shared destructive presentation floor`);
|
|
109
89
|
}
|
|
110
90
|
/**
|
|
111
91
|
* Canonical role → shadcn custom-property name.
|
|
112
92
|
*
|
|
93
|
+
* The default source of each name: `shadcnVariables` replaces `--destructive` with
|
|
94
|
+
* the destructive projection, and `--card`, `--popover`, `--muted-foreground` and
|
|
95
|
+
* `--border` with a record's own `shadcn` values when it has them.
|
|
96
|
+
*
|
|
113
97
|
* Every entry is a deliberate correspondence, and the ones that are not a plain
|
|
114
98
|
* rename carry the reason here rather than in the output. A `null` destination
|
|
115
99
|
* is a deliberate "not emitted": the role has no shadcn consumer, and the
|
|
@@ -131,7 +115,7 @@ export const SHADCN_MAPPING = Object.freeze({
|
|
|
131
115
|
text: 'foreground',
|
|
132
116
|
textMuted: 'muted-foreground',
|
|
133
117
|
// shadcn has no tertiary text slot and nothing reads `--subtle-foreground`;
|
|
134
|
-
// `textSubtle` stays a canonical role (the shiki adapter's
|
|
118
|
+
// `textSubtle` stays a canonical role (the shiki adapter's line numbers).
|
|
135
119
|
textSubtle: null,
|
|
136
120
|
// See the header: the interactive colour is shadcn's `primary`.
|
|
137
121
|
accent: 'primary',
|
|
@@ -168,10 +152,9 @@ export function shadcnVariables(theme) {
|
|
|
168
152
|
continue;
|
|
169
153
|
variables[`--${name}`] = role === 'error' ? destructive.fill : theme.colors[role];
|
|
170
154
|
}
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
// the strength measured for this theme so body text stays legible on it.
|
|
155
|
+
// Hover is resolved because its uniform lightness step cannot be expressed as a
|
|
156
|
+
// mix; the subtle tint stays tied to --primary so it follows runtime primary
|
|
157
|
+
// overrides, at the strength measured for this theme so body text stays legible.
|
|
175
158
|
variables['--primary-hover'] = primaryHover(theme.colors.accent, theme.appearance);
|
|
176
159
|
variables['--primary-subtle'] = primarySubtleCss(theme);
|
|
177
160
|
variables['--accent'] = theme.colors.surfaceHover;
|
|
@@ -202,9 +185,7 @@ export function shadcnVariables(theme) {
|
|
|
202
185
|
variables['--destructive-foreground'] = destructive.foreground;
|
|
203
186
|
for (const role of STATUS_ROLES) {
|
|
204
187
|
// Status labels on a subtle fill use the theme's body foreground; this
|
|
205
|
-
// foreground is reserved for text on the role's solid colour.
|
|
206
|
-
// generated shadcn names aligned with SHADCN_MAPPING, especially error →
|
|
207
|
-
// destructive, and resolve the tint against a real canvas so it is opaque.
|
|
188
|
+
// foreground is reserved for text on the role's solid colour.
|
|
208
189
|
const shadcnRole = SHADCN_MAPPING[role];
|
|
209
190
|
variables[`--${shadcnRole}-foreground`] =
|
|
210
191
|
role === 'error' ? destructive.foreground : statusForeground(theme, role);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAalD,MAAM,8BAA8B,GAAG,CAAC,CAAA;AACxC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AACrC,MAAM,iCAAiC,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAA;AAE/F;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAkB;IAC5D,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAC5D,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAC5D,IAAI,CAAC,UAAU,IAAI,CAAC,gBAAgB,IAAI,CAAC,gBAA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C,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,GAAG,QAAQ,OAAO,IAAI,KAAK,CAAA;AACpC,CAAC"}
|
package/dist/adapters/shiki.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* ## Why a registration and not a bundled theme
|
|
20
20
|
*
|
|
21
|
-
* `
|
|
21
|
+
* `toShikiTheme` returns the object; it does not call `loadTheme`, and it does
|
|
22
22
|
* not import Shiki. That keeps this package free of a dependency on a library that
|
|
23
23
|
* is an application's choice, and it means a consumer can register the result
|
|
24
24
|
* however it likes — synchronously, into a custom highlighter, or inside a worker.
|
|
@@ -45,15 +45,7 @@ export interface ShikiTokenSetting {
|
|
|
45
45
|
fontStyle?: string;
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Converts a theme to a Shiki registration.
|
|
50
|
-
*
|
|
51
|
-
* Order matters in Shiki's `settings` list: later entries win, and the scopes here
|
|
52
|
-
* overlap by design (`keyword.operator` is claimed by both `keyword` and
|
|
53
|
-
* `operator`). `operator` is emitted last so its narrower claim wins, which is what
|
|
54
|
-
* every editor does and what makes `+` and `=` read differently from `if` and
|
|
55
|
-
* `return`.
|
|
56
|
-
*/
|
|
48
|
+
/** Converts a theme to a Shiki registration. */
|
|
57
49
|
export declare function toShikiTheme(theme: AdeaTheme): ShikiThemeRegistration;
|
|
58
50
|
/** Every theme as a registration list, ready for `createHighlighter({ themes })`. */
|
|
59
51
|
export declare function toShikiThemes(themes: readonly AdeaTheme[]): ShikiThemeRegistration[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shiki.d.ts","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAA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AED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,sBAAsB,EAAE,CAEpF"}
|
package/dist/adapters/shiki.js
CHANGED
|
@@ -18,15 +18,20 @@
|
|
|
18
18
|
*
|
|
19
19
|
* ## Why a registration and not a bundled theme
|
|
20
20
|
*
|
|
21
|
-
* `
|
|
21
|
+
* `toShikiTheme` returns the object; it does not call `loadTheme`, and it does
|
|
22
22
|
* not import Shiki. That keeps this package free of a dependency on a library that
|
|
23
23
|
* is an application's choice, and it means a consumer can register the result
|
|
24
24
|
* however it likes — synchronously, into a custom highlighter, or inside a worker.
|
|
25
25
|
*/
|
|
26
26
|
import { syntaxRolesHex } from '../derive.js';
|
|
27
|
-
import {
|
|
27
|
+
import { toHex as hex } from '../render.js';
|
|
28
28
|
/**
|
|
29
|
-
* Syntax role → the TextMate scopes it colours.
|
|
29
|
+
* Syntax role → the TextMate scopes it colours, in the order they are emitted.
|
|
30
|
+
*
|
|
31
|
+
* Order matters in Shiki's `settings` list: later entries win, and the scopes here
|
|
32
|
+
* overlap by design (`keyword.operator` is claimed by both `keyword` and
|
|
33
|
+
* `operator`). `operator` is last so its narrower claim wins, which is what every
|
|
34
|
+
* editor does and what makes `+` and `=` read differently from `if` and `return`.
|
|
30
35
|
*
|
|
31
36
|
* The scope lists are the ones an editor grammar actually emits, and several roles
|
|
32
37
|
* claim more than one scope because grammars disagree: a type annotation may arrive
|
|
@@ -52,7 +57,6 @@ const SHIKI_SCOPES = Object.freeze({
|
|
|
52
57
|
type: ['entity.name.type', 'entity.name.class', 'support.type', 'support.class'],
|
|
53
58
|
tag: ['entity.name.tag', 'meta.tag'],
|
|
54
59
|
attribute: ['entity.other.attribute-name'],
|
|
55
|
-
operator: ['keyword.operator'],
|
|
56
60
|
heading: ['markup.heading', 'entity.name.section'],
|
|
57
61
|
link: ['markup.underline.link', 'string.other.link'],
|
|
58
62
|
constant: ['constant', 'support.constant', 'variable.language'],
|
|
@@ -61,16 +65,13 @@ const SHIKI_SCOPES = Object.freeze({
|
|
|
61
65
|
diffDelete: ['markup.deleted', 'meta.diff.header.from-file', 'punctuation.definition.deleted'],
|
|
62
66
|
diffHunk: ['meta.diff.range', 'meta.diff.index', 'punctuation.definition.range.diff'],
|
|
63
67
|
searchMatch: ['markup.highlight', 'markup.underline.match'],
|
|
68
|
+
operator: ['keyword.operator'],
|
|
64
69
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* `operator`). `operator` is emitted last so its narrower claim wins, which is what
|
|
71
|
-
* every editor does and what makes `+` and `=` read differently from `if` and
|
|
72
|
-
* `return`.
|
|
73
|
-
*/
|
|
70
|
+
const FONT_STYLES = Object.freeze({
|
|
71
|
+
comment: 'italic',
|
|
72
|
+
heading: 'bold',
|
|
73
|
+
});
|
|
74
|
+
/** Converts a theme to a Shiki registration. */
|
|
74
75
|
export function toShikiTheme(theme) {
|
|
75
76
|
const roles = syntaxRolesHex(theme);
|
|
76
77
|
const colors = {
|
|
@@ -86,8 +87,6 @@ export function toShikiTheme(theme) {
|
|
|
86
87
|
'editorWhitespace.foreground': hex(theme.colors.border),
|
|
87
88
|
'editorWidget.background': hex(theme.colors.surfaceElevated),
|
|
88
89
|
'editorWidget.border': hex(theme.colors.border),
|
|
89
|
-
// Diff surfaces read the semantic status roles rather than a separate scale,
|
|
90
|
-
// so a diff in the editor and a diff in the conversation use one palette.
|
|
91
90
|
'diffEditor.insertedTextBackground': hex(theme.colors.surface),
|
|
92
91
|
'diffEditor.removedTextBackground': hex(theme.colors.surface),
|
|
93
92
|
'terminal.ansiRed': hex(theme.ansi.red),
|
|
@@ -101,20 +100,13 @@ export function toShikiTheme(theme) {
|
|
|
101
100
|
const settings = [
|
|
102
101
|
{ settings: { foreground: hex(theme.colors.text), background: hex(theme.colors.background) } },
|
|
103
102
|
];
|
|
104
|
-
// Everything except `operator`, which is emitted last and narrows the claim.
|
|
105
103
|
for (const [role, scopes] of Object.entries(SHIKI_SCOPES)) {
|
|
106
|
-
|
|
107
|
-
continue;
|
|
104
|
+
const fontStyle = FONT_STYLES[role];
|
|
108
105
|
settings.push({
|
|
109
106
|
scope: scopes,
|
|
110
|
-
settings: {
|
|
111
|
-
foreground: roles[role],
|
|
112
|
-
...(role === 'comment' ? { fontStyle: 'italic' } : {}),
|
|
113
|
-
...(role === 'heading' ? { fontStyle: 'bold' } : {}),
|
|
114
|
-
},
|
|
107
|
+
settings: { foreground: roles[role], ...(fontStyle ? { fontStyle } : {}) },
|
|
115
108
|
});
|
|
116
109
|
}
|
|
117
|
-
settings.push({ scope: SHIKI_SCOPES.operator, settings: { foreground: roles.operator } });
|
|
118
110
|
return {
|
|
119
111
|
name: `adea-${theme.id}`,
|
|
120
112
|
type: theme.appearance,
|
|
@@ -122,11 +114,6 @@ export function toShikiTheme(theme) {
|
|
|
122
114
|
settings,
|
|
123
115
|
};
|
|
124
116
|
}
|
|
125
|
-
/** Formats a colour as hex, leaving it alone if it cannot be parsed. */
|
|
126
|
-
function hex(value) {
|
|
127
|
-
const parsed = parseColor(value);
|
|
128
|
-
return parsed ? oklchToHex(parsed) : value;
|
|
129
|
-
}
|
|
130
117
|
/** Every theme as a registration list, ready for `createHighlighter({ themes })`. */
|
|
131
118
|
export function toShikiThemes(themes) {
|
|
132
119
|
return themes.map(toShikiTheme);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shiki.js","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shiki.js","sourceRoot":"","sources":["../../src/adapters/shiki.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,C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AAI,EAAE,KAAK,CAAC,UAAU;QACtB,MAAM;QACN,QAAQ;KACT,CAAA;AACH,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,MAA4B;IACxD,OAAO,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -26,9 +26,9 @@ export interface TailwindOptions {
|
|
|
26
26
|
* The `--color-*` namespace, which is what makes `bg-surface` a valid utility.
|
|
27
27
|
*
|
|
28
28
|
* Takes no theme, and that is the point rather than an oversight. Every declaration
|
|
29
|
-
* this emits is a `var()` reference, so the block is identical for
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* this emits is a `var()` reference, so the block is identical for every theme and
|
|
30
|
+
* one stylesheet serves all of them. Accepting a theme would imply the output
|
|
31
|
+
* depended on which theme was passed, and the first person to notice would
|
|
32
32
|
* reasonably conclude they needed one block per theme.
|
|
33
33
|
*/
|
|
34
34
|
export declare function toTailwindTheme(options?: TailwindOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../src/adapters/tailwind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../src/adapters/tailwind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACzC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,eAAoB,GAAG,MAAM,CAWrE"}
|
|
@@ -12,42 +12,21 @@
|
|
|
12
12
|
* application is the point of the adapter: a new role in the schema becomes a
|
|
13
13
|
* utility in every consumer, and a consumer cannot silently fall behind.
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
16
|
-
import { STATUS_ROLES } from '../derive.js';
|
|
17
|
-
function kebab(name) {
|
|
18
|
-
return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
19
|
-
}
|
|
15
|
+
import { CANONICAL_VARIABLES, DERIVED_VARIABLES, variableName } from './css-variables.js';
|
|
20
16
|
/**
|
|
21
17
|
* The `--color-*` namespace, which is what makes `bg-surface` a valid utility.
|
|
22
18
|
*
|
|
23
19
|
* Takes no theme, and that is the point rather than an oversight. Every declaration
|
|
24
|
-
* this emits is a `var()` reference, so the block is identical for
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* this emits is a `var()` reference, so the block is identical for every theme and
|
|
21
|
+
* one stylesheet serves all of them. Accepting a theme would imply the output
|
|
22
|
+
* depended on which theme was passed, and the first person to notice would
|
|
27
23
|
* reasonably conclude they needed one block per theme.
|
|
28
24
|
*/
|
|
29
25
|
export function toTailwindTheme(options = {}) {
|
|
30
26
|
const prefix = options.prefix ?? 'adea';
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
// time. Without it, every theme would need its own stylesheet.
|
|
35
|
-
lines.push('@theme inline {');
|
|
36
|
-
for (const role of THEME_COLOR_KEYS) {
|
|
37
|
-
lines.push(` --color-${kebab(role)}: var(${property(kebab(role))});`);
|
|
38
|
-
}
|
|
39
|
-
lines.push(` --color-surface-sunken: var(${property('surface-sunken')});`);
|
|
40
|
-
lines.push(` --color-cursor: var(${property('cursor')});`);
|
|
41
|
-
lines.push(` --color-selection: var(${property('selection')});`);
|
|
42
|
-
for (const role of STATUS_ROLES) {
|
|
43
|
-
lines.push(` --color-${role}-subtle: var(${property(`${role}-subtle`)});`);
|
|
44
|
-
lines.push(` --color-${role}-foreground: var(${property(`${role}-foreground`)});`);
|
|
45
|
-
}
|
|
46
|
-
for (let index = 1; index <= 6; index += 1) {
|
|
47
|
-
lines.push(` --color-chart-${index}: var(${property(`chart-${index}`)});`);
|
|
48
|
-
}
|
|
49
|
-
for (const key of ANSI_KEYS) {
|
|
50
|
-
lines.push(` --color-ansi-${kebab(key)}: var(${property(`ansi-${kebab(key)}`)});`);
|
|
27
|
+
const lines = ['@theme inline {'];
|
|
28
|
+
for (const { name } of [...CANONICAL_VARIABLES, ...DERIVED_VARIABLES]) {
|
|
29
|
+
lines.push(` --color-${name}: var(${variableName(name, prefix)});`);
|
|
51
30
|
}
|
|
52
31
|
for (const [name, value] of Object.entries(options.extra ?? {})) {
|
|
53
32
|
lines.push(` --color-${name}: ${value};`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind.js","sourceRoot":"","sources":["../../src/adapters/tailwind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tailwind.js","sourceRoot":"","sources":["../../src/adapters/tailwind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAazF;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,OAAO,GAAoB,EAAE;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAA;IACvC,MAAM,KAAK,GAAG,CAAC,iBAAiB,CAAC,CAAA;IACjC,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,mBAAmB,EAAE,GAAG,iBAAiB,CAAC,EAAE,CAAC;QACtE,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACtE,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QAChE,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,KAAK,KAAK,GAAG,CAAC,CAAA;IAC5C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xterm.d.ts","sourceRoot":"","sources":["../../src/adapters/xterm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"xterm.d.ts","sourceRoot":"","sources":["../../src/adapters/xterm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAM7C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;CACpB;AAiBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAwCzD"}
|
package/dist/adapters/xterm.js
CHANGED
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
* sides already agree on; anything assignable to this shape can be passed
|
|
14
14
|
* straight to `terminal.options.theme`.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
const SELECTION_FLOOR = 4.5;
|
|
16
|
+
import { oklchToHex, parseColor, repairContrast } from '../oklch.js';
|
|
17
|
+
import { CONTRAST_FLOORS } from '../policy.js';
|
|
18
|
+
import { mostContrasting, toHex as hex } from '../render.js';
|
|
19
|
+
/** Selected text is text, so it takes the body floor. */
|
|
20
|
+
const SELECTION_FLOOR = CONTRAST_FLOORS.text;
|
|
23
21
|
/**
|
|
24
22
|
* The floor for the glyph under the cursor.
|
|
25
23
|
*
|
|
@@ -83,30 +81,20 @@ export function toXtermTheme(theme) {
|
|
|
83
81
|
};
|
|
84
82
|
}
|
|
85
83
|
/**
|
|
86
|
-
* The
|
|
84
|
+
* The most contrasting candidate as a foreground for `surface`.
|
|
87
85
|
*
|
|
88
|
-
* Repaired if
|
|
89
|
-
* selection colour that sits exactly between its background and its text.
|
|
90
|
-
* repair is bounded so it cannot drift into a colour the palette does not contain
|
|
91
|
-
* by more than a perceptible step.
|
|
86
|
+
* Repaired if none clears the floor, which happens when a palette picks a
|
|
87
|
+
* selection colour that sits exactly between its background and its text.
|
|
92
88
|
*/
|
|
93
89
|
function pickForeground(surface, candidates, floor) {
|
|
94
90
|
if (!surface)
|
|
95
91
|
return candidates[0] ? oklchToHex(candidates[0]) : '#000000';
|
|
96
92
|
if (candidates.length === 0)
|
|
97
93
|
return '#000000';
|
|
98
|
-
|
|
99
|
-
for (const candidate of candidates.slice(1)) {
|
|
100
|
-
if (contrastRatio(candidate, surface) > contrastRatio(best, surface))
|
|
101
|
-
best = candidate;
|
|
102
|
-
}
|
|
94
|
+
const best = mostContrasting(surface, candidates);
|
|
103
95
|
// A generous budget: the alternative to a large lightness move here is an
|
|
104
96
|
// invisible glyph, and the colour is already one of the palette's own.
|
|
105
97
|
const repaired = repairContrast(best, surface, floor, 0.9);
|
|
106
98
|
return oklchToHex(repaired.color);
|
|
107
99
|
}
|
|
108
|
-
function hex(value) {
|
|
109
|
-
const parsed = parseColor(value);
|
|
110
|
-
return parsed ? oklchToHex(parsed) : value;
|
|
111
|
-
}
|
|
112
100
|
//# sourceMappingURL=xterm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xterm.js","sourceRoot":"","sources":["../../src/adapters/xterm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"xterm.js","sourceRoot":"","sources":["../../src/adapters/xterm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,cAAc,CAAA;AAiC5D,yDAAyD;AACzD,MAAM,eAAe,GAAG,eAAe,CAAC,IAAI,CAAA;AAE5C;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACtD,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACtD,MAAM,MAAM,GAAG,U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O,SAAS,CAAA;IAE7C,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IAEjD,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAC1D,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Oklch } from './oklch.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base24's orange (`base09`) and brown (`base0F`), which no ANSI set contains and
|
|
4
|
+
* Adea has no role for, as a fixed hue rotation off red and yellow.
|
|
5
|
+
*
|
|
6
|
+
* A rotation keeps the source's saturation while moving the hue far enough to read
|
|
7
|
+
* as a distinct token.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SYNTHESISED_HUES: Readonly<{
|
|
10
|
+
readonly base09: {
|
|
11
|
+
readonly from: 'red';
|
|
12
|
+
readonly degrees: 26;
|
|
13
|
+
};
|
|
14
|
+
readonly base0F: {
|
|
15
|
+
readonly from: 'yellow';
|
|
16
|
+
readonly degrees: -34;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Base24's `base10` and `base11` as lightness steps past the canvas: below it on a
|
|
21
|
+
* dark scheme ("dark black", "darker than that"), beyond it on a light one, where the
|
|
22
|
+
* normalizer reads the two as the light end of the ANSI ramp.
|
|
23
|
+
*/
|
|
24
|
+
export declare const PAST_CANVAS_STEPS: Readonly<{
|
|
25
|
+
readonly base10: 0.03;
|
|
26
|
+
readonly base11: 0.06;
|
|
27
|
+
}>;
|
|
28
|
+
/** The direction `PAST_CANVAS_STEPS` move in for an appearance. */
|
|
29
|
+
export declare function pastCanvasDirection(appearance: 'dark' | 'light'): 1 | -1;
|
|
30
|
+
export declare function rotateHue(color: Oklch, degrees: number): Oklch;
|
|
31
|
+
//# sourceMappingURL=base24-synthesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base24-synthesis.d.ts","sourceRoot":"","sources":["../src/base24-synthesis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;iBACjB,IAAI,EAAE,KAAK;iBAAE,OAAO,EAAE,EAAE;;;iBACxB,IAAI,EAAE,QAAQ;iBAAE,OAAO,EAAE,CAAC,EAAE;;EAC7B,CAAA;AAEX;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;qBAA2B,IAAI;qBAAU,IAAI;EAAY,CAAA;AAEvF,mEAAmE;AACnE,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAExE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAE9D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base24's orange (`base09`) and brown (`base0F`), which no ANSI set contains and
|
|
3
|
+
* Adea has no role for, as a fixed hue rotation off red and yellow.
|
|
4
|
+
*
|
|
5
|
+
* A rotation keeps the source's saturation while moving the hue far enough to read
|
|
6
|
+
* as a distinct token.
|
|
7
|
+
*/
|
|
8
|
+
export const SYNTHESISED_HUES = Object.freeze({
|
|
9
|
+
base09: { from: 'red', degrees: 26 },
|
|
10
|
+
base0F: { from: 'yellow', degrees: -34 },
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Base24's `base10` and `base11` as lightness steps past the canvas: below it on a
|
|
14
|
+
* dark scheme ("dark black", "darker than that"), beyond it on a light one, where the
|
|
15
|
+
* normalizer reads the two as the light end of the ANSI ramp.
|
|
16
|
+
*/
|
|
17
|
+
export const PAST_CANVAS_STEPS = Object.freeze({ base10: 0.03, base11: 0.06 });
|
|
18
|
+
/** The direction `PAST_CANVAS_STEPS` move in for an appearance. */
|
|
19
|
+
export function pastCanvasDirection(appearance) {
|
|
20
|
+
return appearance === 'light' ? 1 : -1;
|
|
21
|
+
}
|
|
22
|
+
export function rotateHue(color, degrees) {
|
|
23
|
+
return { ...color, h: (color.h + degrees + 360) % 360 };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=base24-synthesis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base24-synthesis.js","sourceRoot":"","sources":["../src/base24-synthesis.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;IACpC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;CAChC,CAAC,CAAA;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAW,CAAC,CAAA;AAEvF,mEAAmE;AACnE,MAAM,UAAU,mBAAmB,CAAC,UAA4B;IAC9D,OAAO,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,OAAe;IACrD,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAA;AACzD,CAAC"}
|
package/dist/derive.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export type StatusRole = (typeof STATUS_ROLES)[number];
|
|
|
83
83
|
* The text colour to draw on a **solid** fill of a status role.
|
|
84
84
|
*
|
|
85
85
|
* Not the appearance's `foreground`, which is the shortcut and is wrong half the
|
|
86
|
-
* time: a dark theme's foreground is near-white, and near-white on
|
|
86
|
+
* time: a dark theme's foreground is near-white, and near-white on Adea Dark's
|
|
87
87
|
* `success` at `#3fb950` measures 2.6:1 — illegible. The correct answer is
|
|
88
88
|
* whichever of the theme's two extremes measures better against the fill, which
|
|
89
89
|
* for a bright green is black and for a deep red is white.
|
package/dist/derive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAM5C,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,UAAU,GACV,MAAM,GACN,KAAK,GACL,WAAW,GACX,UAAU,GACV,SAAS,GACT,MAAM,GACN,UAAU,GACV,aAAa,GACb,SAAS,GACT,YAAY,GACZ,UAAU,GACV,aAAa,CAAA;AAEjB,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,CAAC,CAAA;AAsExE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GACtC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAiC5B;AAED,6EAA6E;AAC7E,wBAAgB,cAAc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