color convertion

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

color convertion

Post by shadowslash » Tue Jun 08, 2010 6:56 am

In a revTalk script, how would I convert the colors I got from the answer color command to result into an HTML-formatted code?

E.g:
I got 255,255,255 in the variable it after using the answer color command, how would I turn that to #FFFFFF which is it's HTML counterpart.

Thank you so much for those who would help me out with this problem.
Parañaque, Philippines
Image
Image

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: color convertion

Post by Mark » Tue Jun 08, 2010 7:22 am

shadowslash,

Code: Select all

put "123,234,241" into myRGB
put "#" into myHex
repeat for each item myItem in myRGB
  put baseConvert(myItem,10,16) after myHex
end repeat
Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply