Re: iCal Calendar Colors
Re: iCal Calendar Colors
- Subject: Re: iCal Calendar Colors
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 24 May 2005 09:05:44 -0700
- Thread-topic: iCal Calendar Colors
On 5/24/05 8:43 AM, "Todd Geist" <email@hidden> wrote:
> I tried this question once before but I was so tired the question was
> worthless.
>
> I need to get the RGB color values back for an iCal Calendar.
>
> get color of calendar 1
> -->{58853, 5911, 5911}
>
> What I am used to and what I need is 3 digit RGB colors like "125,
> 125, 125".
>
> I figured out that what I need can be obtained by dividing each of
> the numbers returned by iCal by 257
>
> 229, 23, 23
>
> But what I don't understand is why the different formats for RGB?
> Does this have to do with Hex?
AppleScript RGB integers are 0-65,535. i.e. they're 256*256 deep. Your
3-digit RGB integers as used by Microsoft VBA, for example) are 0-255, i.e.
256 deep.
So the way to convert AppleScript RGB integers to the type you want is to
get the square root and round (not divide by 25). And to convert TO
AppleScript type, just square the number.
set RGB to get color of calendar 1
-->{58853, 5911, 5911}
repeat with i from 1 to 3
set int to item i of RGB
set item i of RGB to (int^0.5) div 1
end repeat
RGB
--> {242, 76, 76}
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden