Jump to content
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

Can you help please?

Link to comment
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

 

Link to comment
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.?

Link to comment
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.

If you don't understand hexadecimal please review the FAQ subforum thread "About bits, numbers and hexadecimal".

Pete

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.