ansilove.js

A script to display ANSi and artscene related file formats on web pages
Log | Files | Refs | README | LICENSE

commit c102bdcee3c8d5678e68a9d40ba6f10d40c274e6
parent f222f374bb01b77f1fa5b10431b3f06723f0c95d
Author: Andy Herbert <andy.herbert@gmail.com>
Date:   Mon, 23 Sep 2013 20:20:28 +0100

Fix ced and workbench palettes.

Diffstat:
Mansilove.js | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/ansilove.js b/ansilove.js @@ -277,8 +277,8 @@ var AnsiLove = (function () { ANSI = [0, 4, 2, 20, 1, 5, 3, 7, 56, 60, 58, 62, 57, 61, 59, 63].map(egaRGB); BIN = [0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63].map(egaRGB); - CED = [7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].map(egaRGB); - WORKBENCH = [[170, 170, 170, 255], [0, 0, 0, 255], [255, 255, 255, 255], [102, 136, 187, 255], [0, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [170, 170, 170, 255], [0, 0, 0, 255], [255, 255, 255, 255], [102, 136, 187, 255], [0, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255]]; + CED = [7, 0].map(egaRGB); + WORKBENCH = [[170, 170, 170, 255], [170, 170, 170, 255], [0, 0, 0, 255], [0, 0, 0, 255], [255, 255, 255, 255], [255, 255, 255, 255], [102, 136, 187, 255], [102, 136, 187, 255], [0, 0, 255, 255], [0, 0, 255, 255], [255, 0, 255, 255], [255, 0, 255, 255], [0, 255, 255, 255], [0, 255, 255, 255], [255, 255, 255, 255], [255, 255, 255, 255]]; function triplets16(file) { var pal, i, r, g, b; @@ -916,10 +916,14 @@ var AnsiLove = (function () { escaped = true; break; default: - if (!inverse) { - imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (foreground + 8) : foreground) + (blink && icecolors ? (background + 8 << 4) : (background << 4))); + if (mode === "ced") { + imageData.set(x - 1, y - 1 + topOfScreen, code, 1); } else { - imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (background + 8) : background) + (blink && icecolors ? (foreground + 8 << 4) : (foreground << 4))); + if (!inverse) { + imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (foreground + 8) : foreground) + (blink && icecolors ? (background + 8 << 4) : (background << 4))); + } else { + imageData.set(x - 1, y - 1 + topOfScreen, code, (bold ? (background + 8) : background) + (blink && icecolors ? (foreground + 8 << 4) : (foreground << 4))); + } } if (++x === columns + 1) { newLine();