Difference between revisions of "Color and Scripting"
m (Help:Color and Scripting moved to Color and Scripting) |
m |
||
Line 1: | Line 1: | ||
{{Help|Misc=*}} | {{#vardefine:ml-cat|LSL/}}{{Help|Misc=*}} | ||
{{LSL Header}} | {{LSL Header}} | ||
Using color in SL scripting is fairly easy. If works by combining values of red, green, and blue light. They are stored like this: | Using color in SL scripting is fairly easy. If works by combining values of red, green, and blue light. They are stored like this: |
Revision as of 15:34, 24 October 2008
Help Portal: |
Avatar | Bug Fixes | Communication | Community | Glossary | Land & Sim | Multimedia | Navigation | Object | Video Tutorials | Viewer | Wiki | Misc |
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Using color in SL scripting is fairly easy. If works by combining values of red, green, and blue light. They are stored like this:
< Red Value, Green Value, Blue Value >
Each red, green, or blue value can be between 0.0 (no color saturation) to 1.0 (total color saturation). These values are determined by combining the colors as if they were light, not paint. Therefore, the combination of all three in total saturation is white:
The combination of all three with no saturation is black:
If there is not saturation on two values, and the third is saturated, you get a pure color:
Color | Hexadecimal for CSS/HTML | Vector for Second Life |
---|---|---|
Red | #ff0000 | <1.0, 0.0, 0.0> |
Green | #00ff00 | <0.0, 1.0, 0.0> |
Blue | #0000ff | <0.0, 0.0, 1.0> |
Orange | #ff7f00 | <1.0, 0.5, 0.0> |
Cyan | #00ffff | <0.0, 1.0, 1.0> |
Pink | #ff007f | <1.0, 0.0, 0.5> |
Yellow | #ffff00 | <1.0, 1.0, 0.0> |
Purple | #990099 | <0.6, 0.0, 0.6> |
White | #ffffff | <1.0, 1.0, 1.0> |
Black | #000000 | <0.0, 0.0, 0.0> |
Converting Hexadecimal to Vectors
To convert from a hexadecimal values used in CSS or HTML to ones usable in Second Life scripting, first convert the number for the red, green and blue saturation from hexadecimal to decimal, then divide that number by 255. Do bear in mind that 3-digit codes are a shorthand form, so each digit should be doubled (F becomes FF, 4 becomes 44, 0 becomes 00 etc)
Hexadecimal | Decimal | Saturation Float |
---|---|---|
FF | 255 | 1.0 |
CC | 204 | 0.8 |
00 | 0 | 0.0 |
FF = total saturation
00 = no saturation
00 on the web = 0 in Second Life
FF on the web = 1 in Second Life
Therefore:
FF00FF = <1.0,0.0,1.0>
Contributor
- Needs TranslationLSL//de
- Needs TranslationLSL//es
- Needs TranslationLSL//el
- Needs TranslationLSL//he
- Needs TranslationLSL//it
- Needs TranslationLSL//ja
- Needs TranslationLSL//ko
- Needs TranslationLSL//nl
- Needs TranslationLSL//hu
- Needs TranslationLSL//no
- Needs TranslationLSL//da
- Needs TranslationLSL//sv
- Needs TranslationLSL//tr
- Needs TranslationLSL//pl
- Needs TranslationLSL//pt
- Needs TranslationLSL//ru
- Needs TranslationLSL//th
- Needs TranslationLSL//uk
- Needs TranslationLSL//zh-Hans
- Needs TranslationLSL//zh-Hant
- Articles in need of version numberLSL/
- Help Portal
- Help/Misc
- Text from In-world Notecards
- Tutorials
- Articles in need of expansion