The simFlight Network Forums

# Changing text colour in LUA

## Recommended Posts

Hi Pete,

As you know I'm using your lua script running on a WideClient PC to show fps, remaining VAS and Ai Count.

I have transferred the file to my laptop and want the text colour to stand out a bit more but I'm struggling in successfully changing the relevant command.

It's light green at present as shown in this line...

wnd.textcol(w, 0x06c0)

This corresponds to decimal 1728 but I cannot see how that number ends up as light green.  I have searched the web for help but all I keep finding are RGB values that will give a certain colour. For example, blue is 0,0,255

##### Share on other sites

19 minutes ago, Ray Proudfoot said:

It's light green at present as shown in this line...

wnd.textcol(w, 0x06c0)

This corresponds to decimal 1728 but I cannot see how that number ends up as light green.  I have searched the web for help but all I keep finding are RGB values that will give a certain colour. For example, blue is 0,0,255

It is RGB, but the colour is encoded as 12 bits per pixel, not 24, so only 4 bits each, not 8 which your 255 would need.

So 6C0 = 6 of Red, 12 of Green, no Blue.

Pete

##### Share on other sites

Hi Pete,

Thanks for your answer. So it's not necessary to convert to decimal. Do you have a link to a calculator that would give the correct value for each colour? I'm really struggling to find anything.

LATER: I should be able to adapt the values from RGB calculators. So if yellow is 255,255,0 would that presumably convert to 0CC0.?

##### Share on other sites

36 minutes ago, Ray Proudfoot said:

LATER: I should be able to adapt the values from RGB calculators. So if yellow is 255,255,0 would that presumably convert to 0CC0.?

No. C is 12, the max in 4 bits is 15 which is F so bright yellow would be 0x0FF0 .  In 24 bits your 255,255,0 would be 0xFFFF00.

Pete

##### Share on other sites

Hi Pete,

I understand hex and the base is 16. A=10, B=11 and so on. I was mistakenly thinking the max would be 12 and not 16.

Got it now, thanks.

##### Share on other sites

5 minutes ago, Ray Proudfoot said:

I was mistakenly thinking the max would be 12 and not 16.

15, not 16. 16 is 0x10, more that 4 bits! ;-)

Pete

##### Share on other sites

3 minutes ago, Pete Dowson said:

15, not 16. 16 is 0x10, more that 4 bits! ;-)

Pete

Woops! :)

## Create an account

Register a new account