Re: Hex colors in Tex-Edit X
Re: Hex colors in Tex-Edit X
- Subject: Re: Hex colors in Tex-Edit X
- From: has <email@hidden>
- Date: Thu, 21 Nov 2002 14:16:18 +0000
JJ wrote:
>
> Anyone know the correct formula for converting 8-bit colour to 16-bit?
>
on RGB_8bit_TO_RGB_16bit(rgb_8bit)
>
set rgb_16bit to {}
>
repeat with i in rgb_8bit
>
set plain_decimal to i * 256
>
set sum to plain_decimal div 256
>
set rgb_16bit to rgb_16bit & (plain_decimal + sum)
>
-- adjust plain decimal to base 256
>
end repeat
>
return rgb_16bit
>
end RGB_8bit_TO_RGB_16bit
Thanks. Thought that might be it, but wanted to check. BTW, the above can
be simplified a bit:
======================================================================
on RGB_8bit_TO_RGB_16bit(rgb_8bit)
set rgb_16bit to {}
repeat with int in rgb_8bit
set rgb_16bit's end to (int * 256) + int
end repeat
return rgb_16bit
end RGB_8bit_TO_RGB_16bit
======================================================================
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.