Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Can you help me?
Started by dep.dahowdy Jan 27 2019 11:20 PM

1 reply to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 2 posts
  • Corona SDK

I would like to know the correct way to get a specific color for my texts. I can easily identify the RGB of each color but by putting those numbers in my code Corona SDK does not show me the correct color. Is there any way I can get the right RGB for Corona SDK?


[TOPIC: post.html]

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,212 posts
  • Enterprise

Colors in Corona are based on 0 (full black), to 1 (full white) and you specify the three color components, red, green blue, so if you want a middle gray you would do:

myTextObject:setFillColor( 0.5, 0.5, 0.5 )

If you want it bright green:

myTextObject:setFillColor( 0, 1, 0 )

If you have colors in a 0..255 range you can do:

myTextObject:setFillColor( 128/255, 0, 0 )

to get a middle red.