Adding color

Hi, 

I’m just practicing on my own entering text and background colors, but a lot of the colors show as white instead of the code I entered.  The basic red, green, blue, work, 125, 0, 255 works, but the orange from work with color.com didn’t work. I tried github dark slate gray 47, 79, 79 and crimson 220, 20, 60 also doesn’t work.  

I don’t get it, am I doing something wrong?

Appreciate any help, 

Thanks.

RGBA colors are encoded 0.0 … 1.0 not 0…255
 
Ex:

obj:setFillColor(0.5, 0.5, 0.5 )

Tip: Better to post code over screenshots of code. Makes it easier for us to help.

You can also divide those colors by 255 to make them suitable for your code.

local colorRed = 47 / 255 local colorGreen = 79 / 255 local colorBlue = 79 / 255 obj:setFillColor(colorRed, colorGreen, colorBlue)

Sorry the snippets were bad, I have better ones now.  I thought any numbers better 0 - 255 were acceptable, I found some sites on google offering color codes, but most don’t work, and I have no idea how to divide colors.  I’m a newbie.

Thanks again.

Take the numbers for the colours that you have and divide them by 255 as bgmadclown showed above, or you could do it this way (which saves three lines of code…

obj:setFillColor ( 47/255, 79/255, 79/255 ) -- Gives your slate grey colour.

What I personally do is have a calculator at hand and work it out before I enter the code

47/255 = .184

79/255 = .309

so the line ends up looking like

obj:setFillColor (.184, .31, .31)

Hope this helps.

Now I understand what 47/255 means; I went to colorschemer.com and tried a few variations and they all worked.  It’s tough being a newbie, but you guys really are a great help.

Thanks so much.

RGBA colors are encoded 0.0 … 1.0 not 0…255
 
Ex:

obj:setFillColor(0.5, 0.5, 0.5 )

Tip: Better to post code over screenshots of code. Makes it easier for us to help.

You can also divide those colors by 255 to make them suitable for your code.

local colorRed = 47 / 255 local colorGreen = 79 / 255 local colorBlue = 79 / 255 obj:setFillColor(colorRed, colorGreen, colorBlue)

Sorry the snippets were bad, I have better ones now.  I thought any numbers better 0 - 255 were acceptable, I found some sites on google offering color codes, but most don’t work, and I have no idea how to divide colors.  I’m a newbie.

Thanks again.

Take the numbers for the colours that you have and divide them by 255 as bgmadclown showed above, or you could do it this way (which saves three lines of code…

obj:setFillColor ( 47/255, 79/255, 79/255 ) -- Gives your slate grey colour.

What I personally do is have a calculator at hand and work it out before I enter the code

47/255 = .184

79/255 = .309

so the line ends up looking like

obj:setFillColor (.184, .31, .31)

Hope this helps.

Now I understand what 47/255 means; I went to colorschemer.com and tried a few variations and they all worked.  It’s tough being a newbie, but you guys really are a great help.

Thanks so much.