May 12, 200421 yr 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.
May 12, 200421 yr Author 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.
May 12, 200421 yr Author 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) ) )
Create an account or sign in to comment