asciify-engine 1.0.54 → 1.0.55

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
@@ -126,12 +126,12 @@ All conversion and render functions accept an `AsciiOptions` object. Spread `DEF
126
126
  | `charset` | `string` | Standard ramp | Characters ordered from dense to sparse, representing brightness levels. |
127
127
  | `brightness` | `number` | `0` | Brightness adjustment from `-1` (darker) to `1` (lighter). |
128
128
  | `contrast` | `number` | `1` | Contrast multiplier applied before character mapping. |
129
- | `invert` | `boolean` | `false` | Inverts the luminance mapping — light areas become dense, dark areas sparse. |
129
+ | `invert` | `boolean \| 'auto'` | `false` | Inverts the luminance mapping — light areas become dense, dark areas sparse. Set to `'auto'` to auto-detect from OS color scheme (light mode → invert, dark mode → normal). |
130
130
  | `renderMode` | `'ascii' \| 'dots'` | `'ascii'` | Render as text characters or circular dot particles. |
131
131
  | `hoverEffect` | `string` | `'none'` | Interactive effect driven by cursor position. See hover effects below. |
132
132
  | `hoverStrength` | `number` | `0` | Effect intensity (0–1). `0` = hover disabled. |
133
133
  | `hoverRadius` | `number` | `0.2` | Effect radius relative to canvas size (0–1). |
134
- | `chromaKey` | `{r,g,b} \| string \| null` | `null` | Remove a background colour (green/blue screen). Keyed pixels become transparent spaces. Accepts `{r,g,b}`, any CSS colour string, or `null` to disable. |
134
+ | `chromaKey` | `true \| 'blue-screen' \| {r,g,b} \| string \| null` | `null` | Remove a background colour. `true` = heuristic green screen (any shade). `'blue-screen'` = heuristic blue screen. Custom: `{r,g,b}` or any CSS hex string keyed by Euclidean distance. `null` to disable. |
135
135
  | `chromaKeyTolerance` | `number` | `60` | Euclidean RGB distance threshold for chroma-key detection. `0` = exact match, higher = more pixels removed (max useful ~100). |
136
136
 
137
137
  ### Chroma Key (Green/Blue Screen)
@@ -148,7 +148,7 @@ asciify(img, canvas, {
148
148
 
149
149
  // Blue screen
150
150
  asciify(img, canvas, {
151
- options: { ...DEFAULT_OPTIONS, chromaKey: 'blue', chromaKeyTolerance: 70 },
151
+ options: { ...DEFAULT_OPTIONS, chromaKey: 'blue-screen', chromaKeyTolerance: 70 },
152
152
  });
153
153
 
154
154
  // Custom RGB key
@@ -238,7 +238,7 @@ stop();
238
238
  | `fontSize` | `number` | `13` | Character size in pixels. |
239
239
  | `speed` | `number` | `1` | Global animation speed multiplier. |
240
240
  | `density` | `number` | `0.55` | Fraction of grid cells that are active (0–1). |
241
- | `accentColor` | `string` | varies | Highlight or leading-character color (any CSS color string). |
241
+ | `accentColor` | `string \| 'auto'` | varies | Highlight or leading-character color (any CSS hex string). Set to `'auto'` to auto-detect: probes `--accent-color`, `--color-accent`, `--accent`, `--primary` CSS variables on `:root`, then falls back to OS color scheme (dark ink in light mode, light ink in dark mode). |
242
242
  | `color` | `string` | — | Override the body character color. |
243
243
 
244
244
  ---
@@ -304,7 +304,7 @@ const animatedHtml = generateAnimatedEmbedCode(frames, options, fps);
304
304
  | `generateEmbedCode` | `(frame, options)` | `string` |
305
305
  | `generateAnimatedEmbedCode` | `(frames, options, fps)` | `string` |
306
306
 
307
- `asciifyVideo` options: `fitTo` (HTMLElement/selector — fits canvas to container + ResizeObserver), `preExtract` (pre-decode all frames, default false), `onReady(video)`, `onFrame()`
307
+ `asciifyVideo` options: `fitTo` (HTMLElement/selector — fits canvas to container + ResizeObserver), `preExtract` (pre-decode all frames, default false), `trim: { start?: number; end?: number }` (loop a time slice in seconds, accepts floats), `onReady(video)`, `onFrame()`
308
308
 
309
309
  ---
310
310
 
package/dist/index.cjs CHANGED
@@ -26,7 +26,14 @@ var CHARSETS = {
26
26
  katakana: " \uFF66\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D",
27
27
  musical: " \u2669\u266A\u266B\u266C\u266D\u266E\u266F",
28
28
  emoji: " \u2B1B\u{1F7EB}\u{1F7E5}\u{1F7E7}\u{1F7E8}\u{1F7E9}\u{1F7E6}\u{1F7EA}\u2B1C",
29
- circles: " .\xB7:\u2218\u25CB\u25E6\xB0\u2022\u2219"
29
+ circles: " .\xB7:\u2218\u25CB\u25E6\xB0\u2022\u2219",
30
+ shadows: " \xB7\u2218\u25E6\u25CB\u25CE\u2299\u25CF\u25C9",
31
+ starfield: " \u02D9\xB7\u2218\u2217\u2726\u2727\u2605\u25C6\u25CF",
32
+ geometric: " \xB7\u25B3\u25B7\u25C7\u25C8\u25C6\u25A3\u25A0\u2588",
33
+ pipes: " \u2576\u2500\u2510\u2514\u251C\u2524\u252C\u2534\u253C\u256C\u2592\u2593\u2588",
34
+ waves: " \u02DC\u223C\u2248\u3030\u224B\u223F\u223E\u222D\u222B",
35
+ shards: " \u2571\u2572\u2573\u25E4\u25E5\u25E3\u25E2\u25B3\u25B2\u25C6\u25FC\u2588",
36
+ smoke: " \xB7\u02D9\u205A\u2056\u2236\u2237\u22EE\u22F0\u22F1\u2234\u2235"
30
37
  };
31
38
  var ART_STYLE_PRESETS = {
32
39
  classic: {
@@ -96,6 +103,44 @@ var ART_STYLE_PRESETS = {
96
103
  charset: CHARSETS.circles,
97
104
  colorMode: "accent",
98
105
  accentColor: "#d4ff00"
106
+ },
107
+ shadows: {
108
+ renderMode: "ascii",
109
+ charset: CHARSETS.shadows,
110
+ colorMode: "accent",
111
+ accentColor: "#50a0ff"
112
+ },
113
+ starfield: {
114
+ renderMode: "ascii",
115
+ charset: CHARSETS.starfield,
116
+ colorMode: "fullcolor"
117
+ },
118
+ geometric: {
119
+ renderMode: "ascii",
120
+ charset: CHARSETS.geometric,
121
+ colorMode: "grayscale"
122
+ },
123
+ pipes: {
124
+ renderMode: "ascii",
125
+ charset: CHARSETS.pipes,
126
+ colorMode: "accent",
127
+ accentColor: "#00ff88"
128
+ },
129
+ waves: {
130
+ renderMode: "ascii",
131
+ charset: CHARSETS.waves,
132
+ colorMode: "fullcolor"
133
+ },
134
+ shards: {
135
+ renderMode: "ascii",
136
+ charset: CHARSETS.shards,
137
+ colorMode: "grayscale"
138
+ },
139
+ smoke: {
140
+ renderMode: "ascii",
141
+ charset: CHARSETS.smoke,
142
+ colorMode: "accent",
143
+ accentColor: "#c850ff"
99
144
  }
100
145
  };
101
146
  var DEFAULT_OPTIONS = {