I had some trouble generating a proper color value for g.setPixel. My current experiments have led to some weird results:
But the shifts look strange - can they be correct?
That's correct (although G goes up to 63) - it's called 'RGB565' and is a standard way of packing RGB data into 16 bits.
If you just want an easy solution use g.setColor though :)
Oh, that's interesting...I never heard of RGB565 before - but good to know.
I need that conversion because of g.setPixel which expects a color value as its last argument.
I've just updated the docs, but it turns out that if you leave out the last argument it just defaults to using the foreground color so you can use setColor first if you need to.
I guess there should really be a 'toColor` function to make the process easier
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem