Color Format in the README #10
Answered
by
jonasgeiler
pauladam94
asked this question in
Q&A
|
I don't understand what is the color format ? 255 seems to be blue |
Answered by
jonasgeiler
Apr 12, 2024
Replies: 2 comments
|
Ok I figured it out. local function rgb(r, g, b)
return r * 256 * 256 + g * 256 + b
end |
0 replies
|
This library uses 24-bit colors. If you ever used hexadecimal colors in CSS or a graphics program like Photoshop, they work pretty similarly. For using RGB there is a utility called -- RGB to 24-bit color
fenster.rgb(255, 0, 0) -- returns 0xff0000
-- 24-bit color to RGB
fenster.rgb(0xff0000) -- returns 255, 0, 0 |
0 replies
Answer selected by
jonasgeiler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This library uses 24-bit colors. If you ever used hexadecimal colors in CSS or a graphics program like Photoshop, they work pretty similarly.
For example
#ff0000(Red) would look like0xff0000in Lua, which is just the number16711680in a nicer format.So basically the colors go from
0x000000(Black,0) to0xffffff(White,16777215).Just play around with the
window:set()function and try different colors, I'm sure you'll figure it out.For using RGB there is a utility called
fenster.rgb()which you can use to convert from and to RGB: