@glyph-engine/web 0.1.0 → 0.1.1

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.
@@ -26,3 +26,4 @@ export declare class GlyphAtlas {
26
26
  slot(weight: number, key: number | string, char: string, defaultWeight: string, fontSize: number, family: string): number;
27
27
  writeCells(data: Uint32Array, frame: Frame, fg: number, bg: number, fontWeight: string, fontSize: number, family: string): void;
28
28
  }
29
+ export declare function isColorGlyph(px: Uint8ClampedArray): boolean;
package/dist/index.js CHANGED
@@ -412,9 +412,11 @@ class GlyphAtlas {
412
412
  this.generation++;
413
413
  }
414
414
  }
415
+ var NOISE = 16;
415
416
  function isColorGlyph(px) {
416
417
  for (let i = 0;i < px.length; i += 4) {
417
- if (px[i + 3] > 0 && (px[i] !== px[i + 1] || px[i + 1] !== px[i + 2]))
418
+ const r = px[i], g = px[i + 1], b = px[i + 2];
419
+ if (px[i + 3] > 0 && Math.max(r, g, b) - Math.min(r, g, b) > NOISE)
418
420
  return true;
419
421
  }
420
422
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glyph-engine/web",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "GlyphEngine in the browser: run() with text, canvas, WebGL2 and WebGPU renderers.",
5
5
  "keywords": [
6
6
  "ascii",
@@ -37,6 +37,6 @@
37
37
  "prepack": "cp ../../LICENSE ."
38
38
  },
39
39
  "dependencies": {
40
- "@glyph-engine/core": "0.1.0"
40
+ "@glyph-engine/core": "0.1.1"
41
41
  }
42
42
  }