Color Format in the README #10
-
I don't understand what is the color format ? 255 seems to be blue |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Ok I figured it out. local function rgb(r, g, b)
return r * 256 * 256 + g * 256 + b
end |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
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 like0xff0000
in Lua, which is just the number16711680
in 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: