diff --git a/dither-image.js b/dither-image.js index eeb0f7a..040ed5e 100644 --- a/dither-image.js +++ b/dither-image.js @@ -28,9 +28,9 @@ class RGB { } static fromHex(val) { - let r = val & 0xff; - let g = (val >> 8) & 0xff; - let b = (val >> 16) & 0xff; + let r = (val >>> 16) & 0xff; + let g = (val >>> 8) & 0xff; + let b = val & 0xff; return new RGB(r,g,b); } @@ -618,7 +618,7 @@ async function convert(source, nbits) { // Start with all colors usable with regular CTIA modes // (not the 16-luminance special mode on GTIA) let allColors = []; - for (let i = 0; i < 0xff; i += 2) { + for (let i = 0; i < 256; i += 2) { allColors.push(i); }