ansimax 1.2.5 → 1.2.7

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 CHANGED
@@ -7,10 +7,10 @@
7
7
  _Colors • Gradients • Animations • ASCII Art • Pixel Art • Trees • Components • Themes_
8
8
 
9
9
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE)
10
- [![npm](https://img.shields.io/badge/npm-v1.2.5-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
10
+ [![npm](https://img.shields.io/badge/npm-v1.2.7-cb3837.svg?style=flat-square)](https://www.npmjs.com/package/ansimax)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6.svg?style=flat-square)](tsconfig.json)
12
12
  [![Coverage](https://img.shields.io/badge/coverage-98%25-brightgreen.svg?style=flat-square)](#testing)
13
- [![Tests](https://img.shields.io/badge/tests-1700%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
13
+ [![Tests](https://img.shields.io/badge/tests-1900%2B%20passing-brightgreen.svg?style=flat-square)](#testing)
14
14
  [![Zero deps](https://img.shields.io/badge/dependencies-0-brightgreen.svg?style=flat-square)](#)
15
15
  [![Bundle](https://img.shields.io/badge/bundle-%3C100kb-brightgreen.svg?style=flat-square)](#)
16
16
 
@@ -49,7 +49,7 @@ Ansimax is a **batteries-included rendering library** for building beautiful ter
49
49
  npm install ansimax
50
50
  ```
51
51
 
52
- ```ts
52
+ ```js
53
53
  import { color, gradient, ascii, loader, sleep } from 'ansimax';
54
54
 
55
55
  console.log(ascii.banner('hello', {
@@ -122,7 +122,7 @@ yarn add ansimax
122
122
 
123
123
  ## ⚡ 30-second example
124
124
 
125
- ```ts
125
+ ```js
126
126
  import { color, gradient, loader, ascii, sleep } from 'ansimax';
127
127
 
128
128
  console.log(ascii.banner('deploy', {
@@ -140,7 +140,7 @@ console.log(color.green('✓') + ' Ready in ' + color.bold('1.4s'));
140
140
 
141
141
  ## 🚀 Quick Start
142
142
 
143
- ```ts
143
+ ```js
144
144
  import { configure, color, themes, gradient } from 'ansimax';
145
145
 
146
146
  // Global configuration
@@ -186,7 +186,7 @@ console.log(themes.primary('cyberpunk primary'));
186
186
 
187
187
  <img src="media/colors.png" alt="Colors and gradients" />
188
188
 
189
- ```ts
189
+ ```js
190
190
  import { color, gradient, rainbow } from 'ansimax';
191
191
 
192
192
  // Basic colors
@@ -204,7 +204,7 @@ console.log(rainbow('built-in rainbow preset'));
204
204
 
205
205
  ### Animated Gradients (v1.2.0)
206
206
 
207
- ```ts
207
+ ```js
208
208
  import { animateGradient, sleep } from 'ansimax';
209
209
 
210
210
  // Color flow animation — runs until you call stop()
@@ -227,7 +227,7 @@ await animateGradient('Done!', ['#50fa7b', '#bd93f9'], {
227
227
 
228
228
  <img src="media/easing_curves.png" alt="Colors and gradients" />
229
229
 
230
- ```ts
230
+ ```js
231
231
  import { gradient } from 'ansimax';
232
232
 
233
233
  const stops = ['#ff79c6', '#bd93f9', '#8be9fd'];
@@ -247,7 +247,7 @@ console.log(gradient('hello world', stops, { easing: (t) => t * t * t }));
247
247
 
248
248
  <img src="media/conic_gradients.png" alt="Colors and gradients" />
249
249
 
250
- ```ts
250
+ ```js
251
251
  import { gradientRect } from 'ansimax';
252
252
 
253
253
  // Radial sweep around center — rainbow wheel
@@ -262,7 +262,7 @@ console.log(gradientRect({
262
262
 
263
263
  ### Reusable Gradients (v1.2.3)
264
264
 
265
- ```ts
265
+ ```js
266
266
  import { createGradient, reverseGradient, ascii } from 'ansimax';
267
267
 
268
268
  // Pre-resolve hex stops once — significantly faster for repeated use
@@ -294,7 +294,7 @@ for (let p = 0; p < 1; p += 0.05) {
294
294
 
295
295
  <img src="media/ascii_art.png" alt="ASCII art" />
296
296
 
297
- ```ts
297
+ ```js
298
298
  import { ascii, gradient } from 'ansimax';
299
299
 
300
300
  console.log(ascii.banner('HELLO', {
@@ -308,13 +308,28 @@ console.log(ascii.box('Rainbow box!', { padding: 1, borderStyle: 'rounded' }));
308
308
 
309
309
  ### Image → ASCII (v1.2.5)
310
310
 
311
- ```ts
311
+ ```js
312
312
  import { ascii } from 'ansimax';
313
- import type { PixelGrid } from 'ansimax';
313
+ import sharp from 'sharp';
314
+
315
+ // Get raw RGB pixels from any image library — example using `sharp`.
316
+ // You can use jimp, pngjs, canvas, or any decoder. Ansimax stays zero-deps.
317
+ const { data, info } = await sharp('./photo.png')
318
+ .raw()
319
+ .toBuffer({ resolveWithObject: true });
320
+
321
+ // Convert raw RGB buffer → PixelGrid (a 2D array of { r, g, b } objects)
322
+ const pixels = [];
323
+ for (let y = 0; y < info.height; y++) {
324
+ const row = [];
325
+ for (let x = 0; x < info.width; x++) {
326
+ const i = (y * info.width + x) * info.channels;
327
+ row.push({ r: data[i], g: data[i + 1], b: data[i + 2] });
328
+ }
329
+ pixels.push(row);
330
+ }
314
331
 
315
- // Get a PixelGrid from any image library (sharp, jimp, pngjs, etc.)
316
- // Each Pixel is `{ r, g, b }` or null
317
- const pixels: PixelGrid = await loadImagePixels('./photo.png');
332
+ // Now use ansimax multiple ways:
318
333
 
319
334
  // Monochrome
320
335
  console.log(ascii.fromImage(pixels, { width: 80 }));
@@ -336,7 +351,7 @@ console.log(ascii.fromImage(pixels, {
336
351
  }));
337
352
 
338
353
  // Face mode for portraits (boosts midtone contrast)
339
- console.log(ascii.fromImage(portraitPixels, {
354
+ console.log(ascii.fromImage(pixels, {
340
355
  width: 60,
341
356
  ramp: 'detailed',
342
357
  faceMode: true,
@@ -345,9 +360,9 @@ console.log(ascii.fromImage(portraitPixels, {
345
360
 
346
361
  ### Figlet Fonts (v1.2.5)
347
362
 
348
- ```ts
363
+ ```js
349
364
  import { readFileSync } from 'node:fs';
350
- import { parseFiglet, ascii } from 'ansimax';
365
+ import { parseFiglet, ascii, gradient } from 'ansimax';
351
366
 
352
367
  // Download fonts from http://www.figlet.org/fontdb.cgi
353
368
  const font = parseFiglet(readFileSync('./standard.flf', 'utf8'));
@@ -364,7 +379,7 @@ console.log(ascii.figletText('STYLE', font, {
364
379
 
365
380
  <img src="media/trees.png" alt="Trees" />
366
381
 
367
- ```ts
382
+ ```js
368
383
  import { tree, color } from 'ansimax';
369
384
 
370
385
  const project = tree({ label: 'my-app', icon: '📦', color: color.bold });
@@ -383,7 +398,7 @@ console.log(project.render({
383
398
 
384
399
  <img src="media/pixel_art.png" alt="Pixel art" />
385
400
 
386
- ```ts
401
+ ```js
387
402
  import { images, createCanvas, gradientRect, SPRITES } from 'ansimax';
388
403
 
389
404
  // Built-in sprite
@@ -409,7 +424,7 @@ c.print();
409
424
 
410
425
  <img src="media/components.png" alt="Components" />
411
426
 
412
- ```ts
427
+ ```js
413
428
  import { components, color } from 'ansimax';
414
429
 
415
430
  console.log(components.table([
@@ -419,7 +434,7 @@ console.log(components.table([
419
434
  ['loaders', color.green('● ready'), '100%'],
420
435
  ], { borderStyle: 'rounded' }));
421
436
 
422
- console.log(components.badge('VERSION', 'v1.2.5'));
437
+ console.log(components.badge('VERSION', 'v1.2.7'));
423
438
  console.log(components.badge('BUILD', 'passing'));
424
439
  ```
425
440
 
@@ -427,7 +442,7 @@ console.log(components.badge('BUILD', 'passing'));
427
442
 
428
443
  <img src="media/timeline.png" alt="Timeline" />
429
444
 
430
- ```ts
445
+ ```js
431
446
  import { components } from 'ansimax';
432
447
 
433
448
  console.log(components.timeline([
@@ -440,7 +455,7 @@ console.log(components.timeline([
440
455
 
441
456
  ### Loaders & Progress
442
457
 
443
- ```ts
458
+ ```js
444
459
  import { loader, sleep } from 'ansimax';
445
460
 
446
461
  // Spinner with success/failure
@@ -469,7 +484,7 @@ await loader.tasks([
469
484
 
470
485
  ### Animations
471
486
 
472
- ```ts
487
+ ```js
473
488
  import { animate, gradient, sleep } from 'ansimax';
474
489
 
475
490
  await animate.typewriter('Welcome to the deployment wizard...', {
@@ -491,7 +506,7 @@ await animate.parallel([
491
506
 
492
507
  <img src="media/themes.png" alt="Themes" />
493
508
 
494
- ```ts
509
+ ```js
495
510
  import { themes, createTheme } from 'ansimax';
496
511
 
497
512
  // Built-in themes
@@ -580,7 +595,7 @@ node examples/all-in-one.cjs
580
595
 
581
596
  Global config affects every module that respects it (colors, themes, animation speed, etc.):
582
597
 
583
- ```ts
598
+ ```js
584
599
  import { configure, getConfig, withConfig, onConfigKeyChange } from 'ansimax';
585
600
 
586
601
  configure({
@@ -822,6 +837,59 @@ ansimax/
822
837
 
823
838
  ## 📝 Changelog
824
839
 
840
+ ### v1.2.7 — Bug fixes + robustness
841
+
842
+ Patch release focused on edge case handling and better DX:
843
+
844
+ - 🐛 **`fromImage` rejects invalid dimensions explicitly** — `width: 0`, `NaN`, `Infinity` now return `''` instead of clamping silently
845
+ - 🐛 **`figletText('')` returns `''`** — previously returned empty rows
846
+ - 🛡️ **Non-rectangular grids handled gracefully** — rows of different widths no longer crash `fromImage`
847
+ - 🎯 **Error codes added throughout ASCII module** — `ANSIMAX_INVALID_FIGLET_HEADER`, `ANSIMAX_INVALID_FONT_NAME`, etc. for programmatic catch
848
+ - 📝 **Better error messages** — `parseFiglet` now includes a snippet of the problematic input
849
+
850
+ ```js
851
+ try {
852
+ ascii.registerFont('big', myFont); // 'big' is reserved
853
+ } catch (e) {
854
+ if (e.code === 'ANSIMAX_RESERVED_FONT_NAME') {
855
+ ascii.registerFont('big', myFont, { force: true }); // override
856
+ }
857
+ }
858
+ ```
859
+
860
+ Drop-in replacement for `1.2.6`.
861
+
862
+ ### v1.2.6 — ASCII module improvements
863
+
864
+ Patch release with ASCII engine improvements:
865
+
866
+ - 🎨 **4 new built-in ramps** — `binary`, `dots`, `shades`, `ascii64`
867
+ - 🖼️ **`bgColor` option** in `fromImage` — colors go on background (great with `ramp: 'binary'` for photo effect)
868
+ - 🔆 **`brightness` and `contrast`** pre-adjustment in `fromImage` — tune tonal range without re-processing
869
+ - 📏 **`kerning` option** in `figletText` — control space between glyphs
870
+ - 📄 **Multi-line `figletText`** — input with `\n` renders multiple FIGfont blocks with optional `lineSpacing`
871
+
872
+ ```js
873
+ import { ascii, ASCII_RAMPS } from 'ansimax';
874
+
875
+ // Photo-like rendering with colored background blocks
876
+ console.log(ascii.fromImage(pixels, {
877
+ width: 80,
878
+ bgColor: true,
879
+ ramp: 'binary',
880
+ brightness: 0.1,
881
+ contrast: 0.2,
882
+ }));
883
+
884
+ // Multi-line figlet with spacing
885
+ console.log(ascii.figletText('TITLE\nSUBTITLE', font, {
886
+ kerning: 1,
887
+ lineSpacing: 1,
888
+ }));
889
+ ```
890
+
891
+ Drop-in replacement for `1.2.5`.
892
+
825
893
  ### v1.2.5 — Phase 3 complete: image-to-ASCII engine
826
894
 
827
895
  Minor release closing the ASCII engine roadmap with 5 new features:
@@ -833,8 +901,16 @@ Minor release closing the ASCII engine roadmap with 5 new features:
833
901
  - 🔠 **Figlet (.flf) support** — `parseFiglet()` + `ascii.figletText()` for 250+ community fonts
834
902
  - ⚡ **Bonus: Sobel edge detection** — `edgeDetect: 'sobel'` for line-art effects
835
903
 
836
- ```ts
837
- import { ascii } from 'ansimax';
904
+ ```js
905
+ import { readFileSync } from 'node:fs';
906
+ import { ascii, parseFiglet } from 'ansimax';
907
+
908
+ // Build a small PixelGrid by hand (use sharp/jimp/etc for real images —
909
+ // see Image → ASCII section above)
910
+ const pixels = [
911
+ [{ r: 255, g: 0, b: 0 }, { r: 0, g: 255, b: 0 }],
912
+ [{ r: 0, g: 0, b: 255 }, { r: 255, g: 255, b: 0 }],
913
+ ];
838
914
 
839
915
  // Image to ASCII (input from sharp/jimp/etc, no decoder dependency)
840
916
  console.log(ascii.fromImage(pixels, {
@@ -859,7 +935,7 @@ Patch release adding inspection metadata and a `reverseGradient()` helper:
859
935
  - 🔄 **`reverseGradient()` helper** — flips a gradient's stop order (works with arrays or `ReusableGradient`)
860
936
  - 🎯 **`presets` exported as canonical name** — alongside the existing `colorPresets` alias
861
937
 
862
- ```ts
938
+ ```js
863
939
  import { createGradient, reverseGradient } from 'ansimax';
864
940
 
865
941
  const fire = createGradient(['#ff5555', '#ffb86c', '#f1fa8c']);
@@ -880,8 +956,8 @@ Patch release adding a performance-oriented API:
880
956
  - 📖 More JSDoc with runnable examples
881
957
  - 🎯 Matches the `ColorFn` signature — works as `colorFn` in `ascii.banner`, themes, etc.
882
958
 
883
- ```ts
884
- import { createGradient } from 'ansimax';
959
+ ```js
960
+ import { createGradient, ascii } from 'ansimax';
885
961
 
886
962
  const fire = createGradient(['#ff5555', '#ffb86c', '#f1fa8c']);
887
963
  console.log(fire('Reused colors!'));
@@ -910,7 +986,7 @@ Minor release closing the gradient engine roadmap with three powerful features:
910
986
  - 📐 **Easing curves** — `linear` / `ease-in` / `ease-out` / `ease-in-out` / `cubic-bezier` / custom functions
911
987
  - ⭕ **Conic gradients** — `gradientRect({ style: 'conic', startAngle })` for radial sweeps
912
988
 
913
- ```ts
989
+ ```js
914
990
  import { animateGradient } from 'ansimax';
915
991
 
916
992
  const ctrl = animateGradient('Loading...', ['#ff79c6', '#bd93f9', '#8be9fd']);
package/dist/index.d.mts CHANGED
@@ -1117,16 +1117,38 @@ interface StreamOptions {
1117
1117
  * Character ramps for luminance → glyph mapping.
1118
1118
  * Each ramp is ordered dark → light.
1119
1119
  *
1120
- * - `standard` — balanced 10-char ramp, works for most images
1120
+ * - `standard` — balanced 10-char ramp, works for most images (default)
1121
1121
  * - `detailed` — 70-char ramp from Paul Bourke, max detail at small sizes
1122
1122
  * - `blocks` — Unicode block fills, looks like a real photo at distance
1123
1123
  * - `simple` — 4-char minimal ramp
1124
+ * - `binary` — pure 2-char ramp: space + filled block
1125
+ * - `dots` — Unicode braille dots (sparse aesthetic)
1126
+ * - `shades` — Unicode shading gradient with high tonal range
1127
+ * - `ascii64` — printable ASCII subset, 64 chars, good for non-Unicode terminals
1128
+ *
1129
+ * @example
1130
+ * ```js
1131
+ * import { ascii, ASCII_RAMPS } from 'ansimax';
1132
+ *
1133
+ * console.log(ASCII_RAMPS.blocks); // ' ░▒▓█'
1134
+ * console.log(ASCII_RAMPS.shades); // ' ⠁⠃⠇⠧⠷⡷⣷⣿█'
1135
+ *
1136
+ * // Use directly by name
1137
+ * ascii.fromImage(pixels, { ramp: 'shades' });
1138
+ *
1139
+ * // Or pass a custom ramp string
1140
+ * ascii.fromImage(pixels, { ramp: ' .oO@' });
1141
+ * ```
1124
1142
  */
1125
1143
  declare const ASCII_RAMPS: {
1126
1144
  readonly standard: " .:-=+*#%@";
1127
1145
  readonly detailed: " .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$";
1128
1146
  readonly blocks: " ░▒▓█";
1129
1147
  readonly simple: " .+#";
1148
+ readonly binary: " █";
1149
+ readonly dots: " ⠁⠃⠇⠧⠷⡷⣷⣿";
1150
+ readonly shades: " ⠁⠃⠇⠧⠷⡷⣷⣿█";
1151
+ readonly ascii64: " `.'^,_:-+=<>i!lI?/\\|()1{}[]rcvunxzjftLCJUYXZO0Qoahkbdpqwm*WMB8&%$#@";
1130
1152
  };
1131
1153
  type AsciiRamp = keyof typeof ASCII_RAMPS | string;
1132
1154
  /**
@@ -1199,6 +1221,32 @@ interface FromImageOptions {
1199
1221
  * midtone detail (where faces typically live). Best for portrait input.
1200
1222
  */
1201
1223
  faceMode?: boolean;
1224
+ /**
1225
+ * Render the source pixel's color as the **background** instead of the
1226
+ * foreground. Useful when paired with `ramp: 'binary'` for a photo-like
1227
+ * effect where chars become "pixels". Default `false`.
1228
+ *
1229
+ * Implies `color: true` — does not need to be set separately.
1230
+ *
1231
+ * @since 1.2.6
1232
+ */
1233
+ bgColor?: boolean;
1234
+ /**
1235
+ * Brightness adjustment applied to luminance before quantization.
1236
+ * Range `[-1, 1]`. `0` = no change, `0.2` = lighter, `-0.2` = darker.
1237
+ * Default `0`.
1238
+ *
1239
+ * @since 1.2.6
1240
+ */
1241
+ brightness?: number;
1242
+ /**
1243
+ * Contrast adjustment applied to luminance before quantization.
1244
+ * Range `[-1, 1]`. `0` = no change, `0.5` = boosted, `-0.5` = flattened.
1245
+ * Default `0`.
1246
+ *
1247
+ * @since 1.2.6
1248
+ */
1249
+ contrast?: number;
1202
1250
  }
1203
1251
  declare const fromImage: (pixels: PixelGrid, opts?: FromImageOptions) => string;
1204
1252
  /** A parsed FIGfont — opaque to the user; pass to `ascii.figlet()`. */
@@ -1244,10 +1292,24 @@ declare const parseFiglet: (flfContent: string) => FigletFont;
1244
1292
  * ```
1245
1293
  */
1246
1294
  interface FigletOptions {
1247
- /** Trim leading/trailing spaces per row. Default `true`. */
1295
+ /** Trim leading/trailing blank rows. Default `true`. */
1248
1296
  trim?: boolean;
1249
1297
  /** Color function applied to the assembled output. */
1250
1298
  colorFn?: ColorFn | null;
1299
+ /**
1300
+ * Extra spacing (in characters) inserted between each glyph.
1301
+ * `0` = touching glyphs, `1` = one-space gap, etc. Default `0`.
1302
+ *
1303
+ * @since 1.2.6
1304
+ */
1305
+ kerning?: number;
1306
+ /**
1307
+ * Vertical spacing (blank lines) between rendered lines when `text`
1308
+ * contains `\n`. Default `0`.
1309
+ *
1310
+ * @since 1.2.6
1311
+ */
1312
+ lineSpacing?: number;
1251
1313
  }
1252
1314
  declare const figletText: (text: string, font: FigletFont, opts?: FigletOptions) => string;
1253
1315
  declare const ascii: {
package/dist/index.d.ts CHANGED
@@ -1117,16 +1117,38 @@ interface StreamOptions {
1117
1117
  * Character ramps for luminance → glyph mapping.
1118
1118
  * Each ramp is ordered dark → light.
1119
1119
  *
1120
- * - `standard` — balanced 10-char ramp, works for most images
1120
+ * - `standard` — balanced 10-char ramp, works for most images (default)
1121
1121
  * - `detailed` — 70-char ramp from Paul Bourke, max detail at small sizes
1122
1122
  * - `blocks` — Unicode block fills, looks like a real photo at distance
1123
1123
  * - `simple` — 4-char minimal ramp
1124
+ * - `binary` — pure 2-char ramp: space + filled block
1125
+ * - `dots` — Unicode braille dots (sparse aesthetic)
1126
+ * - `shades` — Unicode shading gradient with high tonal range
1127
+ * - `ascii64` — printable ASCII subset, 64 chars, good for non-Unicode terminals
1128
+ *
1129
+ * @example
1130
+ * ```js
1131
+ * import { ascii, ASCII_RAMPS } from 'ansimax';
1132
+ *
1133
+ * console.log(ASCII_RAMPS.blocks); // ' ░▒▓█'
1134
+ * console.log(ASCII_RAMPS.shades); // ' ⠁⠃⠇⠧⠷⡷⣷⣿█'
1135
+ *
1136
+ * // Use directly by name
1137
+ * ascii.fromImage(pixels, { ramp: 'shades' });
1138
+ *
1139
+ * // Or pass a custom ramp string
1140
+ * ascii.fromImage(pixels, { ramp: ' .oO@' });
1141
+ * ```
1124
1142
  */
1125
1143
  declare const ASCII_RAMPS: {
1126
1144
  readonly standard: " .:-=+*#%@";
1127
1145
  readonly detailed: " .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$";
1128
1146
  readonly blocks: " ░▒▓█";
1129
1147
  readonly simple: " .+#";
1148
+ readonly binary: " █";
1149
+ readonly dots: " ⠁⠃⠇⠧⠷⡷⣷⣿";
1150
+ readonly shades: " ⠁⠃⠇⠧⠷⡷⣷⣿█";
1151
+ readonly ascii64: " `.'^,_:-+=<>i!lI?/\\|()1{}[]rcvunxzjftLCJUYXZO0Qoahkbdpqwm*WMB8&%$#@";
1130
1152
  };
1131
1153
  type AsciiRamp = keyof typeof ASCII_RAMPS | string;
1132
1154
  /**
@@ -1199,6 +1221,32 @@ interface FromImageOptions {
1199
1221
  * midtone detail (where faces typically live). Best for portrait input.
1200
1222
  */
1201
1223
  faceMode?: boolean;
1224
+ /**
1225
+ * Render the source pixel's color as the **background** instead of the
1226
+ * foreground. Useful when paired with `ramp: 'binary'` for a photo-like
1227
+ * effect where chars become "pixels". Default `false`.
1228
+ *
1229
+ * Implies `color: true` — does not need to be set separately.
1230
+ *
1231
+ * @since 1.2.6
1232
+ */
1233
+ bgColor?: boolean;
1234
+ /**
1235
+ * Brightness adjustment applied to luminance before quantization.
1236
+ * Range `[-1, 1]`. `0` = no change, `0.2` = lighter, `-0.2` = darker.
1237
+ * Default `0`.
1238
+ *
1239
+ * @since 1.2.6
1240
+ */
1241
+ brightness?: number;
1242
+ /**
1243
+ * Contrast adjustment applied to luminance before quantization.
1244
+ * Range `[-1, 1]`. `0` = no change, `0.5` = boosted, `-0.5` = flattened.
1245
+ * Default `0`.
1246
+ *
1247
+ * @since 1.2.6
1248
+ */
1249
+ contrast?: number;
1202
1250
  }
1203
1251
  declare const fromImage: (pixels: PixelGrid, opts?: FromImageOptions) => string;
1204
1252
  /** A parsed FIGfont — opaque to the user; pass to `ascii.figlet()`. */
@@ -1244,10 +1292,24 @@ declare const parseFiglet: (flfContent: string) => FigletFont;
1244
1292
  * ```
1245
1293
  */
1246
1294
  interface FigletOptions {
1247
- /** Trim leading/trailing spaces per row. Default `true`. */
1295
+ /** Trim leading/trailing blank rows. Default `true`. */
1248
1296
  trim?: boolean;
1249
1297
  /** Color function applied to the assembled output. */
1250
1298
  colorFn?: ColorFn | null;
1299
+ /**
1300
+ * Extra spacing (in characters) inserted between each glyph.
1301
+ * `0` = touching glyphs, `1` = one-space gap, etc. Default `0`.
1302
+ *
1303
+ * @since 1.2.6
1304
+ */
1305
+ kerning?: number;
1306
+ /**
1307
+ * Vertical spacing (blank lines) between rendered lines when `text`
1308
+ * contains `\n`. Default `0`.
1309
+ *
1310
+ * @since 1.2.6
1311
+ */
1312
+ lineSpacing?: number;
1251
1313
  }
1252
1314
  declare const figletText: (text: string, font: FigletFont, opts?: FigletOptions) => string;
1253
1315
  declare const ascii: {