user4957: Using After Effects expressions, I can create a color reference by pick-whipping a color control and the result is:
var rgb = rgbToHsl(effect("Color Control")("Color"));

But, I want to avoid using a color control, and simply instantiate a color through code:
var rgb = rgbToHsl([159,27,41,1]);

...but this doesn't seem to work.  Is it possible?

user4957: Note: I'm new to this exchange, and I posted this to the graphic design exchange, but my question got migrated here. I thought it had been deleted, so I proceeded to post it on Creative Cow.  I got a great answer there, and I'd like to give credit to Kevin Camp, who answered it perfectly:
your rgb values need to be in values 0-1 rather than 0-255. so if you want to stick with entering 0-255 values you just need to divide that array by 255...
var myColor = rgbToHsl([159,27,41,255]/255);

note, i did assume that you wante the alpha component to be full (255) not 1. if i guessed wrong, change the alpha back to 1.

user2836: From what I'm reading, it looks like it may just be [R,G,B] where each value is a floating point number between 0 and 1.  I'm looking in the Adobe After Effects Scripting Guide.  Every method I can find that accepts a color value simply uses an array like that.
Update: While certain scripting methods take a 3 parameter RGB value, other expressions require RGBA or HSLA.  In these cases, there will be a forth parameter for Alpha (ie, transparency) where 1 is fully opaque (a good default value) and 0 is fully transparent.  If you get an error with one format, I suggest trying the other and if you get unexpected values, check if the input expects HSL or RGB.

4957: <p>Using After Effects expressions, I can create a color reference by pick-whipping a color control and the result is:</p>

<pre><code>var rgb = rgbToHsl(effect("Color Control")("Color"));
</code></pre>

<p>But, I want to avoid using a color control, and simply instantiate a color through code:</p>

<pre><code>var rgb = rgbToHsl([159,27,41,1]);
</code></pre>

<p>...but this doesn't seem to work.  Is it possible?</p>
 4957: <p><strong>Note:</strong> I'm new to this exchange, and I posted this to the graphic design exchange, but my question got migrated here. I thought it had been deleted, so I proceeded to post it on Creative Cow.  I got a great answer there, and I'd like to give credit to Kevin Camp, who <a href="http://forums.creativecow.net/readpost/227/25506" rel="nofollow">answered it perfectly</a>:</p>

<p>your rgb values need to be in values 0-1 rather than 0-255. so if you want to stick with entering 0-255 values you just need to divide that array by 255...</p>

<pre><code>var myColor = rgbToHsl([159,27,41,255]/255);
</code></pre>

<p>note, i did assume that you wante the alpha component to be full (255) not 1. if i guessed wrong, change the alpha back to 1.</p>
 2836: <p>From what I'm reading, it looks like it may just be [R,G,B] where each value is a floating point number between 0 and 1.  I'm looking in the <a href="http://blogs.adobe.com/aftereffects/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf?file=2012/06/After-Effects-CS6-Scripting-Guide.pdf" rel="noreferrer">Adobe After Effects Scripting Guide</a>.  Every method I can find that accepts a color value simply uses an array like that.</p>

<p>Update: While certain scripting methods take a 3 parameter RGB value, other expressions require RGBA or HSLA.  In these cases, there will be a forth parameter for Alpha (ie, transparency) where 1 is fully opaque (a good default value) and 0 is fully transparent.  If you get an error with one format, I suggest trying the other and if you get unexpected values, check if the input expects HSL or RGB.</p>
