Font color coding

Help and techniques for creating Air Manager Instrument Graphics

Moderators: Ralph, russ

Post Reply
Message
Author
sikorsky77
Posts: 22
Joined: Sun Dec 06, 2015 1:09 pm

Font color coding

#1 Post by sikorsky77 » Fri Dec 28, 2018 10:59 am

Hi all

i have a problem with Gauges made with Raspberry and 5 inches WhaveShare screen ,when i use the syntax "color:white" for example
some color like "white", "yellow", "red" are well visible whatever the angle of vision but some of them like "green" disappear
so i decide to use the decimal color coding to choose finely the best variance of green to have it visible (like green fluo) and there is no documentation on in the wiki
what is the syntax of Decimal color coding after "color:" like what i see in Paint for example (see attached screenshot)
Color set.PNG
i know it is also possible to use the Hexa coding #..........
but what soft i can use in windows 10 to have the Hexa coding of a selected color

thanks to the community and Siminnovation team for his support
best regards
Thierry

User avatar
Ralph
Posts: 5079
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Font color coding

#2 Post by Ralph » Fri Dec 28, 2018 11:22 am

You can use a tool like this: https://www.rgbtohex.net/
So then it'll be for example color:#00FF00

User avatar
Sling
Posts: 4433
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Font color coding

#3 Post by Sling » Fri Dec 28, 2018 3:29 pm

Thierry,

You can also use the windows calculator it can convert decimal numbers to hex. The syntax is as follows.

You can specify it directly in line with the text style as Ralph posted like this.

“font:myfont.ttf; size:11; color: #00FF00; halign:left;”

Or if you have a few elements that you want to do this with you can specify a variable and use that in line like this. This has the advantage of just having to change the hex code in a single place.

color_green = “#00FF00”
“font:myfont.ttf; size:11; color: “ .. color_green ..”; halign:left;”

I hope this helps

Tony

sikorsky77
Posts: 22
Joined: Sun Dec 06, 2015 1:09 pm

Re: Font color coding

#4 Post by sikorsky77 » Sat Dec 29, 2018 9:22 am

Thanks Ralf for the tool
Thanks Sling too
i practice too this method you describe with parameter to format easily text with 16 variables at the beginning of the code
i create by default 3 size font pixel , 10 font color , 3 font name variables, that effectively permit me to adapt text formatting with 1 , 2 or 3 variables without coding error all the line impacted with these formatted elements

best regards
Thierry

sikorsky77
Posts: 22
Joined: Sun Dec 06, 2015 1:09 pm

Re: Font color coding

#5 Post by sikorsky77 » Sun Dec 30, 2018 12:25 am

Hi Ralf and Sling

works fine with Hexacode green #00FF00 i can see the text whatever the angle of vision like the other colors
is there in a .ini or cfg file containing the color coding for the standard color name (example green = #00FF00 ) ?

Thanks a lot
Thierry

User avatar
Sling
Posts: 4433
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Font color coding

#6 Post by Sling » Sun Dec 30, 2018 2:03 am

Define the colour names at the beginning of your code. You could create another Lua file in the lib folder for this purpose if you choose.

Tony

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest