asciify-engine 1.0.58 → 1.0.60

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/dist/index.cjs CHANGED
@@ -284,7 +284,8 @@ function getCellColorStr(cell, colorMode, acR, acG, acB, _isInverted = false) {
284
284
  case "matrix":
285
285
  return GREEN_LUT[0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b | 0];
286
286
  case "accent": {
287
- const ab = (0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b) / 255;
287
+ const rawAb = (0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b) / 255;
288
+ const ab = _isInverted ? 1 - rawAb : rawAb;
288
289
  return `rgb(${acR * ab | 0},${acG * ab | 0},${acB * ab | 0})`;
289
290
  }
290
291
  default: {
@@ -309,7 +310,8 @@ function getCellColorRGB(cell, colorMode, acR, acG, acB, _isInverted = false) {
309
310
  break;
310
311
  }
311
312
  case "accent": {
312
- const ab = (0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b) / 255;
313
+ const rawAb = (0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b) / 255;
314
+ const ab = _isInverted ? 1 - rawAb : rawAb;
313
315
  _colorRGB[0] = acR * ab | 0;
314
316
  _colorRGB[1] = acG * ab | 0;
315
317
  _colorRGB[2] = acB * ab | 0;
@@ -907,8 +909,8 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
907
909
  }
908
910
  }
909
911
  if (!hasTransparency) {
910
- const isInvertedBg = resolveInvert(options.invert);
911
- ctx.fillStyle = isInvertedBg ? "#faf9f7" : "#0a0a0a";
912
+ const isDarkScheme = typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches;
913
+ ctx.fillStyle = isDarkScheme ? "#0a0a0a" : "#faf9f7";
912
914
  ctx.fillRect(0, 0, canvasWidth, canvasHeight);
913
915
  }
914
916
  const cellW = canvasWidth / cols;