LSL Wiki Mirror 10-5-2006: color

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::

Color


In LSL, color, a component of light, is specified as a vector, containing 3 floating point values, ranging from 0.0 to 1.0, each for red, green, and blue.

Example: vector color = <1,.5,0>; // 100% red, 50% green, 0% blue = orange

Functions

llGetColor
llSetColor
llGetPrimitiveParams
llSetPrimitiveParams
llSetLinkColor


The following functions will convert from an RGB color, with values from 0 to 255, to SL color, and back.
vector sl2rgb( vector sl )
{
    sl *= 255;                //Scale the SL color up by 255
    return <(integer)sl.x, (integer)sl.y, (integer)sl.z>;    //Make each part of it a whole number
}

vector rgb2sl( vector rgb )
{
    return rgb / 255;        //Scale the RGB color down by 255
}

You can also use Pick Color to convert from RGB (0-255) to SL (0-1) color scale or divide the RGB vector by 255 if you want to figure it out manually.


Texture | Light
There is no comment on this page. [Display comments/form]