asciify-engine 1.0.57 → 1.0.58
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 +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -277,7 +277,7 @@ for (let _i = 0; _i < 256; _i++) {
|
|
|
277
277
|
GRAY_LUT[_i] = `rgb(${_i},${_i},${_i})`;
|
|
278
278
|
GREEN_LUT[_i] = `rgb(0,${_i},0)`;
|
|
279
279
|
}
|
|
280
|
-
function getCellColorStr(cell, colorMode, acR, acG, acB,
|
|
280
|
+
function getCellColorStr(cell, colorMode, acR, acG, acB, _isInverted = false) {
|
|
281
281
|
switch (colorMode) {
|
|
282
282
|
case "fullcolor":
|
|
283
283
|
return `rgb(${cell.r},${cell.g},${cell.b})`;
|
|
@@ -289,12 +289,12 @@ function getCellColorStr(cell, colorMode, acR, acG, acB, isInverted = false) {
|
|
|
289
289
|
}
|
|
290
290
|
default: {
|
|
291
291
|
const gray = 0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b | 0;
|
|
292
|
-
return GRAY_LUT[
|
|
292
|
+
return GRAY_LUT[gray];
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
var _colorRGB = [0, 0, 0];
|
|
297
|
-
function getCellColorRGB(cell, colorMode, acR, acG, acB,
|
|
297
|
+
function getCellColorRGB(cell, colorMode, acR, acG, acB, _isInverted = false) {
|
|
298
298
|
switch (colorMode) {
|
|
299
299
|
case "fullcolor":
|
|
300
300
|
_colorRGB[0] = cell.r;
|
|
@@ -316,8 +316,7 @@ function getCellColorRGB(cell, colorMode, acR, acG, acB, isInverted = false) {
|
|
|
316
316
|
break;
|
|
317
317
|
}
|
|
318
318
|
default: {
|
|
319
|
-
|
|
320
|
-
if (isInverted) gray = 255 - gray;
|
|
319
|
+
const gray = 0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b | 0;
|
|
321
320
|
_colorRGB[0] = gray;
|
|
322
321
|
_colorRGB[1] = gray;
|
|
323
322
|
_colorRGB[2] = gray;
|
|
@@ -908,7 +907,8 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
908
907
|
}
|
|
909
908
|
}
|
|
910
909
|
if (!hasTransparency) {
|
|
911
|
-
|
|
910
|
+
const isInvertedBg = resolveInvert(options.invert);
|
|
911
|
+
ctx.fillStyle = isInvertedBg ? "#faf9f7" : "#0a0a0a";
|
|
912
912
|
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
913
913
|
}
|
|
914
914
|
const cellW = canvasWidth / cols;
|