# llLinear2sRGB

*LSL function*

```lsl
vector vector llLinear2sRGB(vector color);
```

- `vector color`: Color vector in the linear RGB space to convert.

- Returns: `vector`
- Energy: 10

Returns a [vector](https://wiki.secondlife.com/wiki/vector) Transforms a color specified in linear RGB colorspace into the sRGB colorspace.

```lsl title="How to use" frame="terminal"
vector result = llLinear2sRGB(ZERO_VECTOR);
```

## Specification

Lights in Second Life are specified in LSL as linear red, green blue values in the range (0.0, 1.0). Internally light calculations are performed in the sRGB colorspace.

The sRGB (Standard Red Green Blue) colorspace is defined in [IEC 61966-2-1:1999](https://www.color.org/srgb04.xalter) and was developed as a joint project between Microsoft and HP.

This calculation is known as an Inverse Electro-Optical Transfer Function (IEOTF).

## Caveats

- The name of this function is actually a misnomer as LSL color is actually in [Rec.709](https://www.color.org/chardata/rgb/BT709.xalter) space, not [sRGB](https://www.color.org/chardata/rgb/srgb.xalter) space. While they are very similar, the gamma value for sRGB is approx. 2.2, whereas the gamma value for Rec.709 is approx. 2.4.
- Scripting for PBR-enabled viewers: If you enter color vectors manually, using the viewer's color picker, enter them as sRGB values. The color picker automatically converts them internally to Linear RGB, so someone using a PBR-enabled viewer will see them correctly. When you apply color vectors directly with a script, however, you must apply sRGB to Blinn-Phong textured faces and Linear RGB to PBR materials.

## See also

### Functions

- [llsRGB2Linear](/functions/llsRGB2Linear/)

To convert from sRGB to the Linear colorspace. (EOTF)

---

*Source: [LlLinear2sRGB](https://wiki.secondlife.com/wiki/LlLinear2sRGB) on the Second Life Wiki. Content from the Second Life Wiki article LlLinear2sRGB (revision 1217965, 2025-02-07), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llLinear2sRGB/
