User:Auryn Beorn/How to get a valid LSL color

From Second Life Wiki
< User:Auryn Beorn
Revision as of 22:26, 2 October 2011 by Auryn Beorn (talk | contribs) (Brief explanation about how to get the right LSL values for a color - It still can be improved)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Any color is always a combination of Red, Green and Blue values. Usually, these values go from 0 to 255. The higher the value, the more you have of that component. They're usually written it this order: R,G,B.

Once you have the values for R, G and B, you need transforming them for LSL, which expects the color as a vector, <R,G,B>, but values for R, G and B need to be from 0 to 1. So, if you have values from 0 to 255, for converting them into 0 to 1, you need dividing them by 255.

This is, we have <R, G, B>, being R, G and B from 0 to 255, as usual, so LSL needs that you do this:

<R/255.0, G/255.0, B/255.0>

for the definitive values for the color.

In order to find the RGB components of a color, there are a lot of resources in the web. Both this: http://www.allprofitallfree.com/color-wheel2.html and this: http://www.ficml.org/jemimap/style/color/wheel.html are good resources for it.

As an example, if we want to use this blue tone:

<6, 172, 255>

it needs to be converted performing this calculation:

<6/255, 172/255, 255/255>

which means that the value we'll put for the color will be this:

<0.023529, 0.67451, 1.0>