Last active
December 6, 2019 08:45
-
-
Save rozek/f1b083474cd21fec461c02c597cd6112 to your computer and use it in GitHub Desktop.
Bangle.js: displays the color palette used by 8-bit display modes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bangle.setLCDMode('120x120'); | |
g.clear(); | |
const Width = g.getWidth(); | |
const Height = g.getHeight(); | |
for (let Row = 0; Row < 16; Row++) { | |
let yMin = 4+Row*7, yMax = 4+(Row+1)*7-1; | |
for (let Column = 0; Column < 16; Column++) { | |
let xMin = 4+Column*7, xMax = 4+(Column+1)*7-1; | |
let PaletteIndex = Row*16 + Column; | |
for (let y = yMin; y <= yMax; y++) { | |
for (let x = xMin; x <= xMax; x++) { | |
g.setPixel(x,y,PaletteIndex); | |
} | |
} | |
} | |
} | |
g.flip(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment