Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7501 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

The problem is the following: I'm parsing a txt file which contains color information in the format

of a number from 0 to 16777215. I know that FM7 can deal with that numbers. For instance, instead of TextColor("Hi";RGB(255;0;0)) you can also use TextColor("Hi";16711680).

I also know how the calculation is done: Red * 65536 + Green * 256 + Blue.

The bad thing for me is that the txt files I'm parsing have interchanged RED and the BLUE values, which means that e.g. Red=255 and Blue=16711680. Is there any chance to reconvert from number values to RGB values?? If so, I could easily interchange R and B in a calculation afterwards.

Posted

Found it out. The solution is a custom function:

Let (

[R = Int ( colornumber/65536 ) ; G = Int ((colornumber-R*65536)/256); B= colornumber-G];

TextColor ("Hi" ; RGB (B ; G ; R) )

)

while colornumber is a number from 0 to 16777215.

Posted

Sorry, typing error... correct function is

Let (

[R = Int ( colornumber/65536 ) ; G = Int ((colornumber-R*65536)/256); B= colornumber-G*256];

TextColor ("Hi" ; RGB (B ; G ; R) )

)

This topic is 7501 days old. Please don't post here. Open a new topic instead.

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.