Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

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

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dep.dahowdy

[GLOBAL: userInfoPane.html]
dep.dahowdy
  • 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]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,648 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.

 

Rob




[topic_controls]
[/topic_controls]