Skip to content

Color Format in the README #10

Answered by jonasgeiler
pauladam94 asked this question in Q&A
Discussion options

You must be logged in to vote

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 like 0xff0000 in Lua, which is just the number 16711680 in a nicer format.
So basically the colors go from 0x000000 (Black, 0) to 0xffffff (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:

-- RGB to 24-bit color
fenster.rgb(255, 0, 0) -- returns 0xff0000

-- 24-bit color to RGB
fenster.rgb(0xff0000) -- returns 255, 0, 0

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jonasgeiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #6 on April 17, 2024 15:30.