@promptctl/rich-js 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/THIRD-PARTY-NOTICES +42 -0
- package/dist/core/animation.d.ts +65 -46
- package/dist/core/animation.js +91 -67
- package/dist/core/ansi.d.ts +19 -12
- package/dist/core/ansi.js +114 -36
- package/dist/core/bidi-data.d.ts +14 -0
- package/dist/core/bidi-data.js +385 -0
- package/dist/core/bidi.d.ts +89 -0
- package/dist/core/bidi.js +615 -0
- package/dist/core/box.d.ts +9 -1
- package/dist/core/box.js +11 -0
- package/dist/core/cell-widths.d.ts +3 -2
- package/dist/core/cell-widths.js +93 -93
- package/dist/core/cells.d.ts +20 -0
- package/dist/core/cells.js +94 -6
- package/dist/core/clock.d.ts +1 -1
- package/dist/core/color.d.ts +56 -57
- package/dist/core/color.js +79 -81
- package/dist/core/console.d.ts +24 -7
- package/dist/core/console.js +27 -8
- package/dist/core/control-codes.d.ts +61 -0
- package/dist/core/control-codes.js +157 -0
- package/dist/core/easing.d.ts +40 -40
- package/dist/core/easing.js +40 -40
- package/dist/core/env.d.ts +6 -0
- package/dist/core/env.js +9 -1
- package/dist/core/export-html.js +5 -4
- package/dist/core/export-lines.d.ts +13 -11
- package/dist/core/export-lines.js +19 -15
- package/dist/core/export-svg.d.ts +3 -3
- package/dist/core/export-svg.js +10 -9
- package/dist/core/json.js +9 -2
- package/dist/core/markup.js +5 -4
- package/dist/core/memo.d.ts +1 -1
- package/dist/core/memo.js +1 -1
- package/dist/core/oklch.d.ts +14 -14
- package/dist/core/oklch.js +10 -10
- package/dist/core/orient.d.ts +68 -0
- package/dist/core/orient.js +224 -0
- package/dist/core/osc8.d.ts +12 -5
- package/dist/core/osc8.js +14 -7
- package/dist/core/paint.d.ts +9 -9
- package/dist/core/paint.js +3 -3
- package/dist/core/pretty.d.ts +1 -1
- package/dist/core/pretty.js +23 -19
- package/dist/core/protocol.d.ts +47 -26
- package/dist/core/protocol.js +31 -23
- package/dist/core/render.d.ts +19 -14
- package/dist/core/render.js +30 -17
- package/dist/core/seal.d.ts +26 -0
- package/dist/core/seal.js +75 -0
- package/dist/core/segment.d.ts +12 -4
- package/dist/core/segment.js +16 -6
- package/dist/core/strip.d.ts +83 -83
- package/dist/core/strip.js +70 -70
- package/dist/core/style.d.ts +46 -18
- package/dist/core/style.js +92 -56
- package/dist/core/text-order.d.ts +51 -0
- package/dist/core/text-order.js +50 -0
- package/dist/core/text.d.ts +12 -2
- package/dist/core/text.js +136 -90
- package/dist/core/timeline.d.ts +5 -5
- package/dist/core/timeline.js +11 -11
- package/dist/core/tween.d.ts +6 -6
- package/dist/core/tween.js +10 -10
- package/dist/core/view.d.ts +5 -5
- package/dist/core/view.js +15 -14
- package/dist/core/wrap.d.ts +24 -6
- package/dist/core/wrap.js +82 -16
- package/dist/host/app.d.ts +50 -9
- package/dist/host/app.js +120 -15
- package/dist/host/host-environment.d.ts +2 -2
- package/dist/host/host-environment.js +2 -2
- package/dist/host/index.d.ts +3 -2
- package/dist/host/index.js +1 -0
- package/dist/host/input.d.ts +42 -9
- package/dist/host/input.js +91 -7
- package/dist/host/terminal-colors.d.ts +18 -0
- package/dist/host/terminal-colors.js +46 -0
- package/dist/host/terminal-host.d.ts +4 -3
- package/dist/host/terminal-host.js +1 -1
- package/dist/index.d.ts +17 -16
- package/dist/index.js +11 -11
- package/dist/node/prompt.d.ts +1 -1
- package/dist/node/prompt.js +1 -1
- package/dist/node/terminal-host.d.ts +1 -1
- package/dist/node/traceback.js +2 -2
- package/dist/renderables/change.d.ts +1 -3
- package/dist/renderables/change.js +6 -8
- package/dist/renderables/effect.d.ts +88 -87
- package/dist/renderables/effect.js +124 -114
- package/dist/renderables/effects.d.ts +105 -76
- package/dist/renderables/effects.js +309 -176
- package/dist/renderables/embed.d.ts +1 -1
- package/dist/renderables/embed.js +2 -2
- package/dist/renderables/flexStrip.d.ts +7 -7
- package/dist/renderables/flexStrip.js +15 -15
- package/dist/renderables/frames.d.ts +7 -16
- package/dist/renderables/frames.js +12 -27
- package/dist/renderables/glyph-effect.d.ts +22 -23
- package/dist/renderables/glyph-effect.js +43 -41
- package/dist/renderables/glyph-effects.d.ts +33 -14
- package/dist/renderables/glyph-effects.js +90 -22
- package/dist/renderables/html-entities.d.ts +1 -1
- package/dist/renderables/html-entities.js +1 -1
- package/dist/renderables/lifecycle.d.ts +8 -10
- package/dist/renderables/lifecycle.js +17 -18
- package/dist/renderables/live.d.ts +2 -2
- package/dist/renderables/live.js +7 -7
- package/dist/renderables/markdown-parse.js +3 -3
- package/dist/renderables/markdown.js +4 -2
- package/dist/renderables/panel.js +7 -5
- package/dist/renderables/progress.d.ts +1 -1
- package/dist/renderables/progress.js +1 -1
- package/dist/renderables/progressBar.d.ts +3 -3
- package/dist/renderables/progressBar.js +21 -18
- package/dist/renderables/prompt.d.ts +1 -1
- package/dist/renderables/scroll.d.ts +1 -1
- package/dist/renderables/scroll.js +3 -3
- package/dist/renderables/spinner.d.ts +4 -4
- package/dist/renderables/spinner.js +10 -10
- package/dist/renderables/syntax.d.ts +2 -2
- package/dist/renderables/syntax.js +9 -4
- package/dist/renderables/table.js +5 -4
- package/dist/renderables/traceback.d.ts +1 -1
- package/dist/renderables/traceback.js +1 -1
- package/dist/renderables/tree.js +3 -3
- package/dist/template-bindings/animation-funcs.d.ts +60 -29
- package/dist/template-bindings/animation-funcs.js +126 -43
- package/dist/template-bindings/color-funcs.d.ts +14 -14
- package/dist/template-bindings/color-funcs.js +25 -25
- package/dist/template-bindings/index.d.ts +16 -14
- package/dist/template-bindings/index.js +17 -14
- package/dist/template-bindings/palette-funcs.d.ts +2 -2
- package/dist/template-bindings/palette-funcs.js +4 -4
- package/dist/template-bindings/style-funcs.d.ts +5 -5
- package/dist/template-bindings/style-funcs.js +16 -16
- package/dist/themes/{transpose.d.ts → adjust.d.ts} +23 -23
- package/dist/themes/{transpose.js → adjust.js} +28 -28
- package/dist/themes/buildPalette.d.ts +6 -5
- package/dist/themes/buildPalette.js +22 -22
- package/dist/themes/colorMath.d.ts +16 -16
- package/dist/themes/colorMath.js +32 -32
- package/dist/themes/data/ansi-tables.d.ts +2 -2
- package/dist/themes/data/ansi-tables.js +2 -2
- package/dist/themes/data/index.js +1 -4
- package/dist/themes/data/textual-ansi.js +0 -143
- package/dist/themes/data/types.d.ts +4 -4
- package/dist/themes/data/types.js +2 -2
- package/dist/themes/palette.d.ts +12 -12
- package/dist/themes/palette.js +16 -16
- package/dist/themes/ramp.d.ts +17 -17
- package/dist/themes/ramp.js +12 -12
- package/dist/themes/registry.d.ts +6 -8
- package/dist/themes/registry.js +6 -8
- package/dist/themes/terminalThemes.d.ts +4 -11
- package/dist/themes/terminalThemes.js +31 -47
- package/dist/widgets/button.d.ts +3 -3
- package/dist/widgets/button.js +8 -8
- package/dist/widgets/checkbox.d.ts +2 -2
- package/dist/widgets/checkbox.js +4 -4
- package/dist/widgets/dropdown.d.ts +3 -3
- package/dist/widgets/dropdown.js +7 -5
- package/dist/widgets/event-router.d.ts +6 -6
- package/dist/widgets/event-router.js +2 -2
- package/dist/widgets/focus-manager.d.ts +3 -3
- package/dist/widgets/focus-manager.js +3 -3
- package/dist/widgets/index.d.ts +2 -2
- package/dist/widgets/index.js +1 -1
- package/dist/widgets/ink.d.ts +3 -3
- package/dist/widgets/ink.js +4 -4
- package/dist/widgets/slider.d.ts +2 -2
- package/dist/widgets/static-item.d.ts +2 -2
- package/dist/widgets/text-input.d.ts +2 -2
- package/dist/widgets/text-input.js +5 -5
- package/dist/widgets/themed-widget.js +4 -4
- package/dist/widgets/toggle.d.ts +4 -4
- package/dist/widgets/toggle.js +6 -6
- package/dist/widgets/types.d.ts +6 -6
- package/dist/widgets/types.js +2 -2
- package/dist/widgets/widget-app.d.ts +10 -10
- package/dist/widgets/widget-app.js +8 -8
- package/dist/widgets/widget-base.d.ts +2 -2
- package/package.json +5 -4
package/dist/themes/colorMath.js
CHANGED
|
@@ -72,7 +72,7 @@ export function darken(color, levels) {
|
|
|
72
72
|
export function lighten(color, levels) {
|
|
73
73
|
return darken(color, -levels);
|
|
74
74
|
}
|
|
75
|
-
/** sRGB → CIE L*a*b* (D65, 2°): the space `shiftLightness` moves a
|
|
75
|
+
/** sRGB → CIE L*a*b* (D65, 2°): the space `shiftLightness` moves a color in. */
|
|
76
76
|
function rgbToLab(c) {
|
|
77
77
|
const [r, g, b] = [c.red, c.green, c.blue].map((v) => srgbToLinear(v / 255));
|
|
78
78
|
const [x, y, z] = [
|
|
@@ -96,7 +96,7 @@ function labToRgb(l, a, b, alpha) {
|
|
|
96
96
|
return new ColorRgba(red, green, blue, alpha);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Move a
|
|
99
|
+
* Move a color's CIE L* by `amount` (0..1 of the L* scale), keeping its alpha.
|
|
100
100
|
* Textual's `Color.lighten`, which drew every shade ladder in the bundled
|
|
101
101
|
* themes, so a ladder derived here continues the ones authored there.
|
|
102
102
|
*/
|
|
@@ -124,8 +124,8 @@ export function contrastFor(bg, substrate = SURFACE_BLACK) {
|
|
|
124
124
|
: new ColorRgba(255, 255, 255);
|
|
125
125
|
}
|
|
126
126
|
// [LAW:one-way-deps] The WCAG measures live in core/color.ts, beside the
|
|
127
|
-
// ColorTable whose `matchReadable` needs them to pick a drawn text
|
|
128
|
-
// below the theme math here. Re-exported so this module stays the
|
|
127
|
+
// ColorTable whose `matchReadable` needs them to pick a drawn text color, and
|
|
128
|
+
// below the theme math here. Re-exported so this module stays the color-math
|
|
129
129
|
// surface.
|
|
130
130
|
export { relativeLuminance, contrastRatio };
|
|
131
131
|
// Iterations for the lightness bisection below. 20 resolves L to ~1e-6 — far
|
|
@@ -148,16 +148,16 @@ const CONTRAST_ITERS = 20;
|
|
|
148
148
|
* in, so the ratio is measured on what the eye actually sees and the returned
|
|
149
149
|
* color is opaque.
|
|
150
150
|
*
|
|
151
|
-
* `drawnAt` is the depth the terminal will draw the pair at. At 256
|
|
151
|
+
* `drawnAt` is the depth the terminal will draw the pair at. At 256 colors
|
|
152
152
|
* the terminal rounds text and background independently, and two roundings
|
|
153
153
|
* can meet in the middle, so the ratio is measured on the drawn pair: a
|
|
154
|
-
*
|
|
154
|
+
* color that loses the floor there is replaced by the nearest cube/grey entry
|
|
155
155
|
* that clears it (whose own rounding is itself). At ANSI the terminal draws
|
|
156
|
-
* each index in its own theme's
|
|
156
|
+
* each index in its own theme's color, so the ratio is measured on
|
|
157
157
|
* `terminal`'s sixteen: a theme whose black is light and white dark (Rosé Pine
|
|
158
|
-
* Dawn) turns the nominal table's sides over. A replacement is the
|
|
158
|
+
* Dawn) turns the nominal table's sides over. A replacement is the color the
|
|
159
159
|
* writer emits as the index nearest `fg` that clears the floor as `terminal`
|
|
160
|
-
* draws it. Truecolor draws the
|
|
160
|
+
* draws it. Truecolor draws the color chosen.
|
|
161
161
|
*
|
|
162
162
|
* [LAW:single-enforcer] The one place "is this text readable, and if not fix
|
|
163
163
|
* it" is decided. Callers route every fg/bg pair through here and the
|
|
@@ -181,23 +181,23 @@ drawnAt = ColorDepth.TRUECOLOR, substrate = SURFACE_BLACK, terminal) {
|
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* `chosen` (composited opaque over `substrate`), or — when the depth the
|
|
184
|
-
* terminal draws at rounds it to a
|
|
184
|
+
* terminal draws at rounds it to a color `accept` refuses — the color the
|
|
185
185
|
* writer emits as the nearest entry `accept` takes. `accept` sees the
|
|
186
|
-
* candidate as drawn, and `drawn`, the same rounding for any other
|
|
186
|
+
* candidate as drawn, and `drawn`, the same rounding for any other color it
|
|
187
187
|
* measures against, so the caller states a floor once and it holds on the
|
|
188
|
-
*
|
|
188
|
+
* colors the terminal shows — at ANSI, `terminal`'s own sixteen, as
|
|
189
189
|
* `ensureContrast` measures there. Truecolor
|
|
190
|
-
* draws from no table, so a
|
|
190
|
+
* draws from no table, so a color refused there has no replacement;
|
|
191
191
|
* `undefined` means nothing the depth draws is accepted.
|
|
192
192
|
*
|
|
193
193
|
* `ensureContrast` is this with a contrast ratio as the floor; this is for a
|
|
194
194
|
* floor that is not text on its background (an open state standing off every
|
|
195
195
|
* closed cell, two planes standing off each other).
|
|
196
196
|
*/
|
|
197
|
-
export function
|
|
197
|
+
export function ensureMinimumDelta(chosen, drawnAt, accept, substrate = SURFACE_BLACK, terminal) {
|
|
198
198
|
// The floor was measured on `chosen` composited over `substrate`, so that
|
|
199
|
-
// opaque
|
|
200
|
-
// ground would composite into a
|
|
199
|
+
// opaque color is what is returned — never a translucent one a different
|
|
200
|
+
// ground would composite into a color `accept` never saw.
|
|
201
201
|
const opaque = drawnBackground(chosen, substrate);
|
|
202
202
|
const table = drawnTable(drawnAt, terminal);
|
|
203
203
|
const drawn = (c) => shownAs(table, drawnBackground(c, substrate));
|
|
@@ -209,17 +209,17 @@ export function ensureDrawn(chosen, drawnAt, accept, substrate = SURFACE_BLACK,
|
|
|
209
209
|
return index === undefined ? undefined : table.written.get(index);
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
|
-
* The
|
|
212
|
+
* The color a ground is shown as at `drawnAt`: composited over `substrate`
|
|
213
213
|
* (the SGR writer's black by default), rounded to the index the writer emits
|
|
214
214
|
* at that depth, and shown as the terminal shows that index — at ANSI, in
|
|
215
|
-
* `terminal`'s own
|
|
215
|
+
* `terminal`'s own color. The one account `ensureMinimumDelta` and `ensureContrast`
|
|
216
216
|
* measure by, for a caller that measures a floor of its own.
|
|
217
217
|
*/
|
|
218
|
-
export function
|
|
219
|
-
return shownAs(drawnTable(drawnAt, terminal), drawnBackground(
|
|
218
|
+
export function compositedColor(color, drawnAt, substrate = SURFACE_BLACK, terminal) {
|
|
219
|
+
return shownAs(drawnTable(drawnAt, terminal), drawnBackground(color, substrate));
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
|
-
* An opaque
|
|
222
|
+
* An opaque color as the terminal shows it: downgraded to the index the
|
|
223
223
|
* writer emits and drawn as the terminal draws that index.
|
|
224
224
|
* [LAW:one-source-of-truth] That rounding is `ColorSpec.downgrade`'s, the one
|
|
225
225
|
* `Style.drawnColors` writes; the tables here only list the candidates.
|
|
@@ -232,13 +232,13 @@ function shownAs(table, opaque) {
|
|
|
232
232
|
* surface is a fact about where the pair is drawn, so it arrives as a value:
|
|
233
233
|
* the SGR writer (`Style.toSgrCodes`) and the exports that picture its output
|
|
234
234
|
* composite over `SURFACE_BLACK`, the default here; a caller that composites
|
|
235
|
-
* its
|
|
235
|
+
* its colors onto a different surface itself names that one.
|
|
236
236
|
* [LAW:no-silent-failure] A surface has nothing under it, so a translucent one
|
|
237
|
-
* has no drawn
|
|
237
|
+
* has no drawn color to offer; `compositeOver` would read its raw RGB as if
|
|
238
238
|
* it were opaque, so it is refused here rather than measured wrong.
|
|
239
|
-
* [LAW:one-source-of-truth] Text is chosen against the
|
|
240
|
-
* show — measuring the raw RGBA reads a
|
|
241
|
-
* that "clears" it can land below the floor. Opaque
|
|
239
|
+
* [LAW:one-source-of-truth] Text is chosen against the color the surface will
|
|
240
|
+
* show — measuring the raw RGBA reads a color that is drawn nowhere, and text
|
|
241
|
+
* that "clears" it can land below the floor. Opaque colors composite to
|
|
242
242
|
* themselves.
|
|
243
243
|
*/
|
|
244
244
|
function drawnBackground(bg, substrate) {
|
|
@@ -248,12 +248,12 @@ function drawnBackground(bg, substrate) {
|
|
|
248
248
|
return bg.compositeOver(substrate);
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
|
-
* The table the terminal draws from at `drawnAt`. The 256-
|
|
252
|
-
* grey ramp are fixed by xterm, so the
|
|
251
|
+
* The table the terminal draws from at `drawnAt`. The 256-color cube and
|
|
252
|
+
* grey ramp are fixed by xterm, so the color written is the color shown.
|
|
253
253
|
* ANSI 0–15 are the terminal theme's own: the writer still picks the index by
|
|
254
254
|
* the nominal table — the Windows console's at WINDOWS — and the terminal
|
|
255
|
-
* shows `terminal`'s
|
|
256
|
-
* Truecolor draws the chosen
|
|
255
|
+
* shows `terminal`'s color there.
|
|
256
|
+
* Truecolor draws the chosen color itself, as do the depths no table stands
|
|
257
257
|
* behind.
|
|
258
258
|
*/
|
|
259
259
|
function drawnTable(drawnAt, terminal) {
|
|
@@ -272,10 +272,10 @@ function drawnTable(drawnAt, terminal) {
|
|
|
272
272
|
/**
|
|
273
273
|
* `fg` held to `minRatio` on `bg` in truecolor, moving in lightness toward
|
|
274
274
|
* `toward` (black or white). `ensureContrast` moves toward the pole `bg`
|
|
275
|
-
* itself contrasts with; a
|
|
275
|
+
* itself contrasts with; a color that already has a side (a palette's
|
|
276
276
|
* `text-*` is its text, tinted) passes that side, since on a ground near the
|
|
277
277
|
* 0.179 cutoff both poles clear and only one also reads on everything else
|
|
278
|
-
* the
|
|
278
|
+
* the color is drawn on. Where `toward` cannot clear `minRatio` on `bg`,
|
|
279
279
|
* the floor wins over the side: the answer is `contrastFor(bg)`.
|
|
280
280
|
*/
|
|
281
281
|
export function ensureContrastToward(fg, bg, minRatio, toward) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type AnsiColorsData } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* The VGA
|
|
3
|
+
* The VGA colors a terminal draws with no theme of its own: Rich's
|
|
4
4
|
* `DEFAULT_TERMINAL_THEME`, and what `textual-ansi` spells its palette in.
|
|
5
5
|
*/
|
|
6
6
|
export declare const VGA_ANSI: AnsiColorsData;
|
|
7
7
|
/**
|
|
8
|
-
* The ANSI tables Textual draws named
|
|
8
|
+
* The ANSI tables Textual draws named colors in for a theme that has no
|
|
9
9
|
* terminal scheme of its own: `MONOKAI` under a dark theme and `ALABASTER`
|
|
10
10
|
* under a light one (`ansi_theme_dark` / `ansi_theme_light` in Textual's
|
|
11
11
|
* `app.py`, values from its `_ansi_theme.py`).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { STANDARD_TABLE } from "../../core/color.js";
|
|
2
2
|
import { ANSI_SLOTS } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
* The VGA
|
|
4
|
+
* The VGA colors a terminal draws with no theme of its own: Rich's
|
|
5
5
|
* `DEFAULT_TERMINAL_THEME`, and what `textual-ansi` spells its palette in.
|
|
6
6
|
*/
|
|
7
7
|
export const VGA_ANSI = Object.fromEntries(ANSI_SLOTS.map((slot, n) => [slot, STANDARD_TABLE.get(n).hex]));
|
|
8
8
|
/**
|
|
9
|
-
* The ANSI tables Textual draws named
|
|
9
|
+
* The ANSI tables Textual draws named colors in for a theme that has no
|
|
10
10
|
* terminal scheme of its own: `MONOKAI` under a dark theme and `ALABASTER`
|
|
11
11
|
* under a light one (`ansi_theme_dark` / `ansi_theme_light` in Textual's
|
|
12
12
|
* `app.py`, values from its `_ansi_theme.py`).
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
// below define the canonical name set for the registry. Adding a theme:
|
|
4
4
|
// 1. drop a new `data/<name>.ts` file,
|
|
5
5
|
// 2. add it here,
|
|
6
|
-
// 3.
|
|
7
|
-
// if you want a pre-built `TerminalTheme` constant alongside the
|
|
8
|
-
// registry palette. Without step 3 the theme is still fully usable
|
|
9
|
-
// via `getThemePalette(name)`.
|
|
6
|
+
// 3. add a matching `<NAME>` export in `terminalThemes.ts`.
|
|
10
7
|
import atomOneDark from "./atom-one-dark.js";
|
|
11
8
|
import atomOneLight from "./atom-one-light.js";
|
|
12
9
|
import catppuccinFrappe from "./catppuccin-frappe.js";
|
|
@@ -5,156 +5,13 @@ const theme = {
|
|
|
5
5
|
ansi: VGA_ANSI,
|
|
6
6
|
vars: {
|
|
7
7
|
"accent": "#0000FF",
|
|
8
|
-
"accent-darken-1": "#0000FF",
|
|
9
|
-
"accent-darken-2": "#0000FF",
|
|
10
|
-
"accent-darken-3": "#0000FF",
|
|
11
|
-
"accent-lighten-1": "#0000FF",
|
|
12
|
-
"accent-lighten-2": "#0000FF",
|
|
13
|
-
"accent-lighten-3": "#0000FF",
|
|
14
|
-
"accent-muted": "#0178D4",
|
|
15
8
|
"background": "#121212",
|
|
16
|
-
"background-darken-1": "#121212",
|
|
17
|
-
"background-darken-2": "#121212",
|
|
18
|
-
"background-darken-3": "#121212",
|
|
19
|
-
"background-lighten-1": "#121212",
|
|
20
|
-
"background-lighten-2": "#121212",
|
|
21
|
-
"background-lighten-3": "#121212",
|
|
22
|
-
"block-cursor-background": "#000080",
|
|
23
|
-
"block-cursor-blurred-background": "#0000804C",
|
|
24
|
-
"block-cursor-blurred-foreground": "#E0E0E0",
|
|
25
|
-
"block-cursor-foreground": "#E0E0E0",
|
|
26
|
-
"block-hover-background": "#00000019",
|
|
27
|
-
"boost": "#0178D4",
|
|
28
|
-
"boost-darken-1": "#0178D4",
|
|
29
|
-
"boost-darken-2": "#0178D4",
|
|
30
|
-
"boost-darken-3": "#0178D4",
|
|
31
|
-
"boost-lighten-1": "#0178D4",
|
|
32
|
-
"boost-lighten-2": "#0178D4",
|
|
33
|
-
"boost-lighten-3": "#0178D4",
|
|
34
|
-
"border": "#0000FF",
|
|
35
|
-
"border-blurred": "#000080",
|
|
36
|
-
"button-color-foreground": "#E0E0E0",
|
|
37
|
-
"button-foreground": "#E0E0E0",
|
|
38
9
|
"error": "#800000",
|
|
39
|
-
"error-darken-1": "#800000",
|
|
40
|
-
"error-darken-2": "#800000",
|
|
41
|
-
"error-darken-3": "#800000",
|
|
42
|
-
"error-lighten-1": "#800000",
|
|
43
|
-
"error-lighten-2": "#800000",
|
|
44
|
-
"error-lighten-3": "#800000",
|
|
45
|
-
"error-muted": "#0178D4",
|
|
46
|
-
"footer-background": "#121212",
|
|
47
|
-
"footer-description-background": "#00000000",
|
|
48
|
-
"footer-description-foreground": "#E0E0E0",
|
|
49
|
-
"footer-foreground": "#E0E0E0",
|
|
50
|
-
"footer-item-background": "#00000000",
|
|
51
|
-
"footer-key-background": "#00000000",
|
|
52
|
-
"footer-key-foreground": "#0000FF",
|
|
53
10
|
"foreground": "#E0E0E0",
|
|
54
|
-
"foreground-darken-1": "#E0E0E0",
|
|
55
|
-
"foreground-darken-2": "#E0E0E0",
|
|
56
|
-
"foreground-darken-3": "#E0E0E0",
|
|
57
|
-
"foreground-disabled": "#00000060",
|
|
58
|
-
"foreground-lighten-1": "#E0E0E0",
|
|
59
|
-
"foreground-lighten-2": "#E0E0E0",
|
|
60
|
-
"foreground-lighten-3": "#E0E0E0",
|
|
61
|
-
"foreground-muted": "#00000099",
|
|
62
|
-
"input-cursor-background": "#121212",
|
|
63
|
-
"input-cursor-foreground": "#E0E0E0",
|
|
64
|
-
"input-selection-background": "#000080",
|
|
65
|
-
"link-background": "#00000000",
|
|
66
|
-
"link-background-hover": "#000080",
|
|
67
|
-
"link-color": "#E0E0E0",
|
|
68
|
-
"link-color-hover": "#0178D4",
|
|
69
|
-
"markdown-h1-background": "#00000000",
|
|
70
|
-
"markdown-h1-color": "#000080",
|
|
71
|
-
"markdown-h2-background": "#00000000",
|
|
72
|
-
"markdown-h2-color": "#000080",
|
|
73
|
-
"markdown-h3-background": "#00000000",
|
|
74
|
-
"markdown-h3-color": "#000080",
|
|
75
|
-
"markdown-h4-background": "#00000000",
|
|
76
|
-
"markdown-h4-color": "#E0E0E0",
|
|
77
|
-
"markdown-h5-background": "#00000000",
|
|
78
|
-
"markdown-h5-color": "#E0E0E0",
|
|
79
|
-
"markdown-h6-background": "#00000000",
|
|
80
|
-
"markdown-h6-color": "#00000099",
|
|
81
|
-
"panel": "#121212",
|
|
82
|
-
"panel-darken-1": "#121212",
|
|
83
|
-
"panel-darken-2": "#121212",
|
|
84
|
-
"panel-darken-3": "#121212",
|
|
85
|
-
"panel-lighten-1": "#121212",
|
|
86
|
-
"panel-lighten-2": "#121212",
|
|
87
|
-
"panel-lighten-3": "#121212",
|
|
88
11
|
"primary": "#000080",
|
|
89
|
-
"primary-background": "#000080",
|
|
90
|
-
"primary-background-darken-1": "#000080",
|
|
91
|
-
"primary-background-darken-2": "#000080",
|
|
92
|
-
"primary-background-darken-3": "#000080",
|
|
93
|
-
"primary-background-lighten-1": "#000080",
|
|
94
|
-
"primary-background-lighten-2": "#000080",
|
|
95
|
-
"primary-background-lighten-3": "#000080",
|
|
96
|
-
"primary-darken-1": "#000080",
|
|
97
|
-
"primary-darken-2": "#000080",
|
|
98
|
-
"primary-darken-3": "#000080",
|
|
99
|
-
"primary-lighten-1": "#000080",
|
|
100
|
-
"primary-lighten-2": "#000080",
|
|
101
|
-
"primary-lighten-3": "#000080",
|
|
102
|
-
"primary-muted": "#0178D4",
|
|
103
|
-
"scrollbar": "#000080",
|
|
104
|
-
"scrollbar-active": "#000080",
|
|
105
|
-
"scrollbar-background": "#121212",
|
|
106
|
-
"scrollbar-background-active": "#121212",
|
|
107
|
-
"scrollbar-background-hover": "#121212",
|
|
108
|
-
"scrollbar-corner-color": "#E0E0E0",
|
|
109
|
-
"scrollbar-hover": "#000040",
|
|
110
12
|
"secondary": "#008080",
|
|
111
|
-
"secondary-background": "#008080",
|
|
112
|
-
"secondary-background-darken-1": "#008080",
|
|
113
|
-
"secondary-background-darken-2": "#008080",
|
|
114
|
-
"secondary-background-darken-3": "#008080",
|
|
115
|
-
"secondary-background-lighten-1": "#008080",
|
|
116
|
-
"secondary-background-lighten-2": "#008080",
|
|
117
|
-
"secondary-background-lighten-3": "#008080",
|
|
118
|
-
"secondary-darken-1": "#008080",
|
|
119
|
-
"secondary-darken-2": "#008080",
|
|
120
|
-
"secondary-darken-3": "#008080",
|
|
121
|
-
"secondary-lighten-1": "#008080",
|
|
122
|
-
"secondary-lighten-2": "#008080",
|
|
123
|
-
"secondary-lighten-3": "#008080",
|
|
124
|
-
"secondary-muted": "#0178D4",
|
|
125
13
|
"success": "#008000",
|
|
126
|
-
"success-darken-1": "#008000",
|
|
127
|
-
"success-darken-2": "#008000",
|
|
128
|
-
"success-darken-3": "#008000",
|
|
129
|
-
"success-lighten-1": "#008000",
|
|
130
|
-
"success-lighten-2": "#008000",
|
|
131
|
-
"success-lighten-3": "#008000",
|
|
132
|
-
"success-muted": "#0178D4",
|
|
133
|
-
"surface": "#121212",
|
|
134
|
-
"surface-active": "#131313",
|
|
135
|
-
"surface-darken-1": "#121212",
|
|
136
|
-
"surface-darken-2": "#121212",
|
|
137
|
-
"surface-darken-3": "#121212",
|
|
138
|
-
"surface-lighten-1": "#121212",
|
|
139
|
-
"surface-lighten-2": "#121212",
|
|
140
|
-
"surface-lighten-3": "#121212",
|
|
141
|
-
"text": "#E0E0E0",
|
|
142
|
-
"text-accent": "#5656FF",
|
|
143
|
-
"text-disabled": "#E0E0E0",
|
|
144
|
-
"text-error": "#AB5656",
|
|
145
|
-
"text-muted": "#E0E0E0",
|
|
146
|
-
"text-primary": "#5656AB",
|
|
147
|
-
"text-secondary": "#56ABAB",
|
|
148
|
-
"text-success": "#56AB56",
|
|
149
|
-
"text-warning": "#ABAB56",
|
|
150
14
|
"warning": "#808000",
|
|
151
|
-
"warning-darken-1": "#808000",
|
|
152
|
-
"warning-darken-2": "#808000",
|
|
153
|
-
"warning-darken-3": "#808000",
|
|
154
|
-
"warning-lighten-1": "#808000",
|
|
155
|
-
"warning-lighten-2": "#808000",
|
|
156
|
-
"warning-lighten-3": "#808000",
|
|
157
|
-
"warning-muted": "#0178D4",
|
|
158
15
|
},
|
|
159
16
|
};
|
|
160
17
|
export default theme;
|
|
@@ -13,7 +13,7 @@ export interface ThemePaletteData {
|
|
|
13
13
|
readonly name: string;
|
|
14
14
|
readonly dark: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* The sixteen
|
|
16
|
+
* The sixteen colors a terminal showing this theme draws `red`, `blue`,
|
|
17
17
|
* `bright_black` and the rest in. A theme without its own table would draw
|
|
18
18
|
* them in the VGA defaults (`blue` as #000080), which belong to no theme.
|
|
19
19
|
*/
|
|
@@ -22,12 +22,12 @@ export interface ThemePaletteData {
|
|
|
22
22
|
readonly vars: Readonly<Record<BaseRole, string> & Partial<Record<PaletteRole, string>>>;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* ANSI
|
|
25
|
+
* ANSI color numbers 0–15 in order: the eight normal colors, then their
|
|
26
26
|
* bright forms. Named rather than positional so a data file cannot shift a
|
|
27
|
-
*
|
|
27
|
+
* color into its neighbour's slot by miscounting.
|
|
28
28
|
*/
|
|
29
29
|
export declare const ANSI_SLOTS: readonly ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "brightBlack", "brightRed", "brightGreen", "brightYellow", "brightBlue", "brightMagenta", "brightCyan", "brightWhite"];
|
|
30
|
-
/** One `#RRGGBB` per ANSI
|
|
30
|
+
/** One `#RRGGBB` per ANSI color number, keyed by `ANSI_SLOTS`. */
|
|
31
31
|
export type AnsiColorsData = {
|
|
32
32
|
readonly [K in (typeof ANSI_SLOTS)[number]]: string;
|
|
33
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ANSI
|
|
2
|
+
* ANSI color numbers 0–15 in order: the eight normal colors, then their
|
|
3
3
|
* bright forms. Named rather than positional so a data file cannot shift a
|
|
4
|
-
*
|
|
4
|
+
* color into its neighbour's slot by miscounting.
|
|
5
5
|
*/
|
|
6
6
|
export const ANSI_SLOTS = [
|
|
7
7
|
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white",
|
package/dist/themes/palette.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type Shade = `-${"darken" | "lighten"}-${1 | 2 | 3}`;
|
|
|
10
10
|
* list is read off those rules.
|
|
11
11
|
*/
|
|
12
12
|
export type PaletteRole = ShadedRole | `${ShadedRole}${Shade}` | `${AccentRole}-muted` | `text-${AccentRole}` | `on-${AccentRole}` | "background-muted" | "foreground-muted" | "foreground-disabled" | "surface-active" | "text" | "text-muted" | "text-disabled" | "border" | "border-blurred" | "block-cursor-background" | "block-cursor-foreground" | "block-cursor-blurred-background" | "block-cursor-blurred-foreground" | "block-hover-background" | "button-foreground" | "button-color-foreground" | "footer-background" | "footer-foreground" | "footer-description-background" | "footer-description-foreground" | "footer-item-background" | "footer-key-background" | "footer-key-foreground" | "input-cursor-background" | "input-cursor-foreground" | "input-selection-background" | "link-background" | "link-background-hover" | "link-color" | "link-color-hover" | `markdown-h${1 | 2 | 3 | 4 | 5 | 6}-${"background" | "color"}` | "scrollbar" | "scrollbar-active" | "scrollbar-hover" | "scrollbar-background" | "scrollbar-background-active" | "scrollbar-background-hover" | "scrollbar-corner-color";
|
|
13
|
-
/** A
|
|
13
|
+
/** A color for each role: what proves a palette complete. */
|
|
14
14
|
export type PaletteRoles = Readonly<Record<PaletteRole, ColorRgba>>;
|
|
15
15
|
/**
|
|
16
16
|
* A semantic palette: a named map from role → ColorRgba, holding every
|
|
@@ -22,20 +22,20 @@ export type PaletteRoles = Readonly<Record<PaletteRole, ColorRgba>>;
|
|
|
22
22
|
*
|
|
23
23
|
* Storage is uniformly ColorRgba; consumers that load from hex JSON
|
|
24
24
|
* parse to ColorRgba at load time. `get` is a bare lookup — turning an
|
|
25
|
-
* author-written *reference* (a name, or a `#RRGGBB` literal) into a
|
|
25
|
+
* author-written *reference* (a name, or a `#RRGGBB` literal) into a color
|
|
26
26
|
* is `resolveColorRef`'s job in `colorRef.ts`, so a Palette never has to
|
|
27
27
|
* know about the syntax callers write.
|
|
28
28
|
*
|
|
29
|
-
* Every
|
|
29
|
+
* Every color a Palette hands out is opaque or fully transparent. A theme's translucent variable
|
|
30
30
|
* (Textual's `boost`, a hover overlay) is a tint meant for that theme's own
|
|
31
|
-
* background, and a
|
|
31
|
+
* background, and a color leaving the palette no longer knows which
|
|
32
32
|
* background that was: the SGR writer would composite it over the terminal's
|
|
33
33
|
* black, which is not the theme's background, and draw a tint the theme never
|
|
34
34
|
* meant.
|
|
35
35
|
* So it is drawn onto `background` here, once, and the writer, the exporters
|
|
36
|
-
* and the contrast choosers all read the
|
|
37
|
-
* surface it keeps that
|
|
38
|
-
* The exception is a fully transparent
|
|
36
|
+
* and the contrast choosers all read the color it has there. On any other
|
|
37
|
+
* surface it keeps that color: the tint does not follow what is under it.
|
|
38
|
+
* The exception is a fully transparent color, Textual's "no background": it
|
|
39
39
|
* draws nothing on any surface, so it needs none and is handed out as it is,
|
|
40
40
|
* and a `Style` reads it as no background at all.
|
|
41
41
|
*
|
|
@@ -48,14 +48,14 @@ export declare class Palette {
|
|
|
48
48
|
constructor(name: string, dark: boolean, roles: PaletteRoles);
|
|
49
49
|
get(role: PaletteRole): ColorRgba;
|
|
50
50
|
get(role: string): ColorRgba | undefined;
|
|
51
|
-
/** This palette's roles, each put through `
|
|
52
|
-
mapRoles(
|
|
51
|
+
/** This palette's roles, each put through `color`: what a new palette is built from. */
|
|
52
|
+
mapRoles(color: (color: ColorRgba, role: PaletteRole) => ColorRgba): PaletteRoles;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* A palette
|
|
55
|
+
* A palette color as it is drawn: composited onto the palette's own
|
|
56
56
|
* `background`, which has nothing under it and so must itself be opaque.
|
|
57
57
|
* [LAW:one-source-of-truth] The one statement of what a translucent palette
|
|
58
|
-
*
|
|
58
|
+
* color means; `buildPalette` draws its base colors through it before
|
|
59
59
|
* deriving from them.
|
|
60
60
|
*/
|
|
61
|
-
export declare function drawnOn(name: string, background: ColorRgba): (
|
|
61
|
+
export declare function drawnOn(name: string, background: ColorRgba): (color: ColorRgba) => ColorRgba;
|
package/dist/themes/palette.js
CHANGED
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Storage is uniformly ColorRgba; consumers that load from hex JSON
|
|
10
10
|
* parse to ColorRgba at load time. `get` is a bare lookup — turning an
|
|
11
|
-
* author-written *reference* (a name, or a `#RRGGBB` literal) into a
|
|
11
|
+
* author-written *reference* (a name, or a `#RRGGBB` literal) into a color
|
|
12
12
|
* is `resolveColorRef`'s job in `colorRef.ts`, so a Palette never has to
|
|
13
13
|
* know about the syntax callers write.
|
|
14
14
|
*
|
|
15
|
-
* Every
|
|
15
|
+
* Every color a Palette hands out is opaque or fully transparent. A theme's translucent variable
|
|
16
16
|
* (Textual's `boost`, a hover overlay) is a tint meant for that theme's own
|
|
17
|
-
* background, and a
|
|
17
|
+
* background, and a color leaving the palette no longer knows which
|
|
18
18
|
* background that was: the SGR writer would composite it over the terminal's
|
|
19
19
|
* black, which is not the theme's background, and draw a tint the theme never
|
|
20
20
|
* meant.
|
|
21
21
|
* So it is drawn onto `background` here, once, and the writer, the exporters
|
|
22
|
-
* and the contrast choosers all read the
|
|
23
|
-
* surface it keeps that
|
|
24
|
-
* The exception is a fully transparent
|
|
22
|
+
* and the contrast choosers all read the color it has there. On any other
|
|
23
|
+
* surface it keeps that color: the tint does not follow what is under it.
|
|
24
|
+
* The exception is a fully transparent color, Textual's "no background": it
|
|
25
25
|
* draws nothing on any surface, so it needs none and is handed out as it is,
|
|
26
26
|
* and a `Style` reads it as no background at all.
|
|
27
27
|
*
|
|
@@ -35,29 +35,29 @@ export class Palette {
|
|
|
35
35
|
this.name = name;
|
|
36
36
|
this.dark = dark;
|
|
37
37
|
// [LAW:single-enforcer] Every palette is built through here, so this is
|
|
38
|
-
// where "a palette
|
|
38
|
+
// where "a palette color is opaque or draws nothing" holds.
|
|
39
39
|
const draw = drawnOn(name, roles.background);
|
|
40
|
-
this.vars = new Map(Object.entries(roles).map(([role,
|
|
40
|
+
this.vars = new Map(Object.entries(roles).map(([role, color]) => [role, draw(color)]));
|
|
41
41
|
}
|
|
42
42
|
get(role) {
|
|
43
43
|
return this.vars.get(role);
|
|
44
44
|
}
|
|
45
|
-
/** This palette's roles, each put through `
|
|
46
|
-
mapRoles(
|
|
47
|
-
return Object.fromEntries([...this.vars].map(([role, was]) => [role,
|
|
45
|
+
/** This palette's roles, each put through `color`: what a new palette is built from. */
|
|
46
|
+
mapRoles(color) {
|
|
47
|
+
return Object.fromEntries([...this.vars].map(([role, was]) => [role, color(was, role)]));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* A palette
|
|
51
|
+
* A palette color as it is drawn: composited onto the palette's own
|
|
52
52
|
* `background`, which has nothing under it and so must itself be opaque.
|
|
53
53
|
* [LAW:one-source-of-truth] The one statement of what a translucent palette
|
|
54
|
-
*
|
|
54
|
+
* color means; `buildPalette` draws its base colors through it before
|
|
55
55
|
* deriving from them.
|
|
56
56
|
*/
|
|
57
57
|
export function drawnOn(name, background) {
|
|
58
58
|
if (background.alpha !== 1) {
|
|
59
|
-
throw new RangeError(`palette ${JSON.stringify(name)}: background is the surface its translucent
|
|
59
|
+
throw new RangeError(`palette ${JSON.stringify(name)}: background is the surface its translucent colors are drawn on, so it must be opaque; got ${background.hex}`);
|
|
60
60
|
}
|
|
61
|
-
// A fully transparent
|
|
62
|
-
return (
|
|
61
|
+
// A fully transparent color is not a tint: it draws nothing on any surface.
|
|
62
|
+
return (color) => (color.alpha === 0 ? color : color.compositeOver(background));
|
|
63
63
|
}
|
package/dist/themes/ramp.d.ts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* color, and none takes a *measurement*. Without a ramp the answer gets
|
|
7
7
|
* computed outside the theme system — a script emits a hex, a template
|
|
8
8
|
* branches `if ge .pct 80 … else if ge .pct 50 …` — and that color decision
|
|
9
|
-
* can no longer
|
|
9
|
+
* can no longer adjust with the palette it was meant to belong to. A ramp
|
|
10
10
|
* is the one function whose input is a number, so the decision stays inside.
|
|
11
11
|
*
|
|
12
12
|
* A threshold cascade is a ramp too: the same stops with the `step` ease hold
|
|
13
13
|
* each color until the next position, which is exactly `≥ threshold → hotter`
|
|
14
14
|
* written as data. [LAW:one-type-per-behavior] One primitive; the easing is a
|
|
15
|
-
* value — any `
|
|
15
|
+
* value — any `Easing` from `core/easing`, the vocabulary every effect shares —
|
|
16
16
|
* so a gradient and a cascade differ by one word, not by which function was
|
|
17
17
|
* called. [LAW:dataflow-not-control-flow] `at` applies it unconditionally.
|
|
18
18
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* midpoints of an sRGB blend.
|
|
22
22
|
*
|
|
23
23
|
* A ramp also carries how far it has been moved: `scroll`, in spans, how
|
|
24
|
-
* far its
|
|
24
|
+
* far its colors have travelled along it, and `hue`, in turns, how far
|
|
25
25
|
* they are rotated round the OKLCH hue circle. A moved ramp is still a
|
|
26
26
|
* `ColorRamp`, so anything that reads a ramp reads a moving one frame by
|
|
27
27
|
* frame (`moving`) with nothing new to learn. [LAW:one-type-per-behavior]
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import { Animation } from "../core/animation.js";
|
|
35
35
|
import type { ColorRgba } from "../core/color.js";
|
|
36
|
-
import { type
|
|
36
|
+
import { type Easing } from "../core/easing.js";
|
|
37
37
|
/** One stop: the color the ramp is exactly `color` at position `at`. */
|
|
38
38
|
export interface ColorStop {
|
|
39
39
|
readonly at: number;
|
|
@@ -42,8 +42,8 @@ export interface ColorStop {
|
|
|
42
42
|
/**
|
|
43
43
|
* How a ramp moves over time, each part an `Animation<number>` that is
|
|
44
44
|
* `Animation.constant(0)` when not given. `scroll` is in spans: at 1 the
|
|
45
|
-
*
|
|
46
|
-
* wrapped back, so `Animation.continuous(
|
|
45
|
+
* colors have travelled the whole way from the first stop to the last and
|
|
46
|
+
* wrapped back, so `Animation.continuous(WrapMode.loop(seconds))` scrolls once
|
|
47
47
|
* every `seconds`. `hue` is in turns, CSS's `turn`: at 1 every hue has gone
|
|
48
48
|
* once round the circle. A one-shot that settles is a `tween` to where it
|
|
49
49
|
* rests.
|
|
@@ -68,13 +68,13 @@ export interface RampMotion {
|
|
|
68
68
|
* same way).
|
|
69
69
|
*/
|
|
70
70
|
export declare class ColorRamp {
|
|
71
|
-
readonly ease:
|
|
71
|
+
readonly ease: Easing;
|
|
72
72
|
readonly stops: readonly ColorStop[];
|
|
73
|
-
/** How far the
|
|
73
|
+
/** How far the colors have moved along the span, in spans, in [0, 1). */
|
|
74
74
|
readonly scroll: number;
|
|
75
75
|
/** How far every hue is rotated in OKLCH, in turns, in [0, 1). */
|
|
76
76
|
readonly hue: number;
|
|
77
|
-
constructor(ease:
|
|
77
|
+
constructor(ease: Easing, stops: readonly ColorStop[], scroll?: number, hue?: number);
|
|
78
78
|
/**
|
|
79
79
|
* The color at `value`. Below the first stop it is the first color; at or
|
|
80
80
|
* above the last stop it is the last; between two stops the raw progress
|
|
@@ -91,26 +91,26 @@ export declare class ColorRamp {
|
|
|
91
91
|
* CSS defines them. An ease that overshoots [0, 1] holds the end colors
|
|
92
92
|
* where it does: a ramp never paints outside its stops.
|
|
93
93
|
*
|
|
94
|
-
* A scrolled ramp reads, inside its span, the
|
|
94
|
+
* A scrolled ramp reads, inside its span, the color `scroll` spans behind
|
|
95
95
|
* `value`, wrapped back round the span as a repeating gradient does —
|
|
96
|
-
* seamless when the first and last stops are one
|
|
97
|
-
* its end
|
|
98
|
-
* the
|
|
96
|
+
* seamless when the first and last stops are one color; outside the span
|
|
97
|
+
* its end colors hold, however far it has scrolled. A rotated ramp turns
|
|
98
|
+
* the color read by `hue` at its own lightness and chroma. Unmoved, every
|
|
99
99
|
* read keeps the exactness above.
|
|
100
100
|
*/
|
|
101
101
|
at(value: number): ColorRgba;
|
|
102
|
-
/** The
|
|
102
|
+
/** The color at `value` with the ramp unmoved: the stops and the ease alone. */
|
|
103
103
|
private unmoved;
|
|
104
104
|
/**
|
|
105
105
|
* This ramp read over time: its span of positions, from the first stop's
|
|
106
106
|
* to the last's, crossed at a steady rate in `seconds` and held at the last
|
|
107
|
-
* stop from then on, each
|
|
107
|
+
* stop from then on, each color along the way the ramp's own. A color
|
|
108
108
|
* tween is a two-stop ramp over its seconds — the ramp's ease shaping the
|
|
109
109
|
* move, so `new ColorRamp(ease, [{ at: 0, color: a }, { at: 1, color: b
|
|
110
110
|
* }]).over(seconds)` is `a` eased to `b` — and a ramp of more stops over
|
|
111
111
|
* time is a sweep through all of them. [LAW:one-source-of-truth] The
|
|
112
112
|
* blending is `at`'s; what time adds is `tween`'s (`core/tween.ts`), so a
|
|
113
|
-
* host sampling once a second or sixty times reads the stop
|
|
113
|
+
* host sampling once a second or sixty times reads the stop colors byte
|
|
114
114
|
* for byte where `at` paints them.
|
|
115
115
|
*/
|
|
116
116
|
over(seconds: number): Animation<ColorRgba>;
|
|
@@ -122,7 +122,7 @@ export declare class ColorRamp {
|
|
|
122
122
|
* [LAW:one-source-of-truth] When it next changes is `Animation.all`'s
|
|
123
123
|
* answer over the two parts; nothing here says it a second time. Whether
|
|
124
124
|
* the depth it is drawn at can show the move is decided where it is drawn
|
|
125
|
-
* (`gradient`, through `
|
|
125
|
+
* (`gradient`, through `staticWhereUnchanged`).
|
|
126
126
|
*/
|
|
127
127
|
moving(motion: RampMotion): Animation<ColorRamp>;
|
|
128
128
|
}
|