Color.ToLAB

Vec3 ToLAB()

Converts the gamma space RGB color to a CIE LAB color space value! Conversion back and forth from LAB space could be somewhat lossy.

   
RETURNS: Vec3 An LAB vector where x=L, y=A, z=B.

Examples

// Desaturating a color can be done quite nicely with the HSV
// functions
Color red      = new Color(1,0,0,1);
Vec3  colorHSV = red.ToHSV();
colorHSV.y *= 0.5f; // Drop saturation by half
Color desaturatedRed = Color.HSV(colorHSV, red.a);

// LAB color space is excellent for modifying perceived 
// brightness, or 'Lightness' of a color.
Color green    = new Color(0,1,0,1);
Vec3  colorLAB = green.ToLAB();
colorLAB.x *= 0.5f; // Drop lightness by half
Color darkGreen = Color.LAB(colorLAB, green.a);




Found an issue with these docs, or have some additional questions? Create an Issue on Github!