Skip to content
lsl.devlsl.devLSL Dev

LlSetColor

Looking for the current API? Open the llSetColor reference →

Wiki description

Sets the Blinn-Phong color on face of the prim.

Caveats

  • llSetColor will have no visible effect on faces with a PBR material. To work on faces both with and without a PBR material, use this snippet:
    if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES)) {
        llSetLinkGLTFOverrides(LINK_THIS, ALL_SIDES, [OVERRIDE_GLTF_BASE_COLOR_FACTOR, llsRGB2Linear(color)]);
    } else {
        llSetColor(color, ALL_SIDES);
    }

Examples

integer face = -1;
vector color = <1.0, 1.0, 1.0>;

default
{
    touch_start(integer num)
    {
        if(~face)       //quick & dirty but efficient way of testing if face is not equal to -1
            llSetColor(color, face); //restore the color
        face = (face + 1) % llGetNumberOfSides(); //increment and keep the face number in range
        color = llGetColor(face); //save the face's color
        llSetColor(<0.5, 0.0, 0.0>, face );  //change the face's color
    }
}

Helper functions

Color Hexadecimal code LSL color representations
NAVY #001f3f<0.000, 0.122, 0.247>
BLUE #0074d9<0.000, 0.455, 0.851>
AQUA #7fdbff<0.498, 0.859, 1.000>
TEAL #39cccc<0.224, 0.800, 0.800>
OLIVE #3d9970<0.239, 0.600, 0.439>
GREEN #2ecc40<0.180, 0.800, 0.251>
LIME #01ff70<0.004, 1.000, 0.439>
YELLOW #ffdc00<1.000, 0.863, 0.000>
ORANGE #ff851b<1.000, 0.522, 0.106>
RED #ff4136<1.000, 0.255, 0.212>
MAROON #85144b<0.522, 0.078, 0.294>
FUCHSIA #f012be<0.941, 0.071, 0.745>
PURPLE #b10dc9<0.694, 0.051, 0.788>
WHITE #ffffff<1.000, 1.000, 1.000>
SILVER #dddddd<0.867, 0.867, 0.867>
GRAY #aaaaaa<0.667, 0.667, 0.667>
BLACK #111111<0.067, 0.067, 0.067>

See also: functions

See also: events

See also: articles

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/color

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:p_{{{1|none}}}_desc|{{LSLGC|Color|color}} in RGB {{LSL_VR|1={{HoverText|R|Red}}, {{HoverText|G|Green}}, {{HoverText|B|Blue}}}} ({{LSL_VR|0.0, 0.0, 0.0}} &#61; black, {{LSL_VR|1.0, 1.0, 1.0}} &#61; white)}}

{{#vardefine:p_{{{1|none}}}_hover|color in RGB {{LSL_VR|R, G, B}} ({{LSL_VR|0.0, 0.0, 0.0}} &#61; black, {{LSL_VR|1.0, 1.0, 1.0}} &#61; white)}}

{{#vardefine:also_articles|{{#var:also_articles}}
{{LSL DefineRow||{{LSLGC|Color|Color in LSL}} {{#switch:{{#if:{{{nc|}}}|Template|{{NAMESPACE}}}}|Template=|User=|{{LSLC|Color}}}} }}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPairTable|also_articles}}
|}
</noinclude>

Template:LSL Function/face

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}{{#if:

{{#vardefine:header|{{#var:header}}{{#if:{{{nc|}}}{{#pos:{{#var:moded}}|r}}||{{#switch:{{NAMESPACE}}|Template=|User=|[[Category:LSL Face{{#var:lang}}]][[Category:LSL Face{{#var:lang}}/{{#if:{{{return|}}}{{{returns|}}}|Get|Set}}]]}}}}}}

{{#vardefine:ALL_SIDES|{{LSL Const|ALL_SIDES|integer|-1|hex=0xFFFFFFFF}}}}

{{#vardefine:p_{{{1|none}}}_desc|{{LSLGC|Face{{#var:lang}}|face}} number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or {{#var:ALL_SIDES}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|face number{{#ifeq:{{{notall|}}}|*||<nowiki> </nowiki>or ALL_SIDES (-1)}}}}

{{#ifeq:{{{notall|}}}|*||{{#vardefine:facechoise|If {{LSLP|{{{1|none}}}}} is {{#var:ALL_SIDES}} then the {{#if:{{{2|}}}|{{{2|}}}|function}} {{#if:{{{get|}}}|{{{get|}}}|{{#if:{{{ALL_SIDES|}}}|{{{ALL_SIDES|}}}|works on all sides.}}}}}}}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{#if:{{{!footer|}}}||{{PBR}}
{{#var:facechoise}}{{PBR}}}}}}

{{#vardefine:caveats|{{#var:caveats}}{{#if:{{{!footer|}}}|
*{{#var:facechoise}}|}}{{#if:{{{return|}}}{{{returns|}}}|
*If {{LSLP|{{{1|none}}}}} indicates a face that does not exist the {{#if:{{{2|}}}|{{{2|}}}}} {{#if:{{{return|}}}|return is {{{return|}}}| returns {{{returns|}}}}}|
*The {{#if:{{{2|}}}|{{{2|}}}|function}} silently fails if its {{LSLP|{{{1|none}}}}} value indicates a face that does not exist.}}}}

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|ALL_SIDES}}
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|-
{{VarPair|facechoise}}
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.