asciify-engine 1.0.46 → 1.0.47

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
@@ -129,8 +129,8 @@ All conversion and render functions accept an `AsciiOptions` object. Spread `DEF
129
129
  | `invert` | `boolean` | `false` | Inverts the luminance mapping — light areas become dense, dark areas sparse. |
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
- | `hoverStrength` | `number` | `0.8` | Effect intensity (0–1). |
133
- | `hoverRadius` | `number` | `0.3` | Effect radius relative to canvas size (0–1). |
132
+ | `hoverStrength` | `number` | `0` | Effect intensity (0–1). `0` = hover disabled. |
133
+ | `hoverRadius` | `number` | `0.2` | Effect radius relative to canvas size (0–1). |
134
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. |
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
 
@@ -141,14 +141,9 @@ Remove a solid background colour from any source — images, GIFs, or video —
141
141
  ```ts
142
142
  import { asciify, DEFAULT_OPTIONS } from 'asciify-engine';
143
143
 
144
- // Green screen
144
+ // Green screen — zero config, just set true:
145
145
  asciify(img, canvas, {
146
- options: {
147
- ...DEFAULT_OPTIONS,
148
- chromaKey: '#00ff00', // CSS colour string — hex, rgb(), named all work
149
- chromaKeyTolerance: 60, // tune to your footage (0 = exact, ~80 = loose)
150
- colorMode: 'fullcolor',
151
- },
146
+ options: { ...DEFAULT_OPTIONS, chromaKey: true, colorMode: 'fullcolor' },
152
147
  });
153
148
 
154
149
  // Blue screen
@@ -164,7 +159,7 @@ asciify(img, canvas, {
164
159
  // Live video with green screen
165
160
  asciifyVideo('/footage.mp4', canvas, {
166
161
  fitTo: '#container',
167
- options: { ...DEFAULT_OPTIONS, chromaKey: '#00b140', chromaKeyTolerance: 65, colorMode: 'fullcolor' },
162
+ options: { ...DEFAULT_OPTIONS, chromaKey: true, colorMode: 'fullcolor' },
168
163
  });
169
164
  ```
170
165
 
package/dist/index.cjs CHANGED
@@ -650,8 +650,9 @@ function imageToAsciiFrame(source, options, targetWidth, targetHeight) {
650
650
  const frame = [];
651
651
  let ckRGB = null;
652
652
  let ckTolSq = 0;
653
- if (options.chromaKey != null) {
654
- ckRGB = parseChromaKeyColor(options.chromaKey);
653
+ const ck = options.chromaKey;
654
+ if (ck != null && ck !== false) {
655
+ ckRGB = ck === true ? { r: 0, g: 177, b: 64 } : parseChromaKeyColor(ck);
655
656
  ckTolSq = (options.chromaKeyTolerance ?? 60) ** 2;
656
657
  }
657
658
  for (let y = 0; y < rows; y++) {