---
title: "LABColor"
language: "en"
type: "Symbol"
summary: "LABColor[l, a, b] represents a color in the CIELAB color space with lightness l and color components a and b. LABColor[l, a, b, \\[Alpha]] specifies opacity \\[Alpha]. LABColor[string] returns a color from an HTML color name etc. LABColor[color] returns the CIELAB representation of color."
keywords: 
- color
- color model
- color space
- Lab colorspace
- Lab
- color opponent
- Hunter 1948 L a b color space
- CIE 1976
- CIE L*a*b*
- CIELAB
- (L* a* b*)
- device independent
- perceptually uniform
- Delta E
- color
- ColorSpec
- lab2double
- lab2uint8
- lab2uint16
canonical_url: "https://reference.wolfram.com/language/ref/LABColor.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Colors"
    link: "https://reference.wolfram.com/language/guide/Colors.en.md"
  - 
    title: "Color Processing"
    link: "https://reference.wolfram.com/language/guide/ColorProcessing.en.md"
  - 
    title: "Image Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md"
related_functions: 
  - 
    title: "RGBColor"
    link: "https://reference.wolfram.com/language/ref/RGBColor.en.md"
  - 
    title: "LCHColor"
    link: "https://reference.wolfram.com/language/ref/LCHColor.en.md"
  - 
    title: "LUVColor"
    link: "https://reference.wolfram.com/language/ref/LUVColor.en.md"
  - 
    title: "XYZColor"
    link: "https://reference.wolfram.com/language/ref/XYZColor.en.md"
  - 
    title: "ThemeColor"
    link: "https://reference.wolfram.com/language/ref/ThemeColor.en.md"
  - 
    title: "Opacity"
    link: "https://reference.wolfram.com/language/ref/Opacity.en.md"
  - 
    title: "Blend"
    link: "https://reference.wolfram.com/language/ref/Blend.en.md"
  - 
    title: "Lighter"
    link: "https://reference.wolfram.com/language/ref/Lighter.en.md"
  - 
    title: "ColorConvert"
    link: "https://reference.wolfram.com/language/ref/ColorConvert.en.md"
  - 
    title: "ColorDistance"
    link: "https://reference.wolfram.com/language/ref/ColorDistance.en.md"
  - 
    title: "DominantColors"
    link: "https://reference.wolfram.com/language/ref/DominantColors.en.md"
  - 
    title: "BrightnessEqualize"
    link: "https://reference.wolfram.com/language/ref/BrightnessEqualize.en.md"
related_tutorials: 
  - 
    title: "Three-Dimensional Graphics Directives"
    link: "https://reference.wolfram.com/language/tutorial/TheStructureOfGraphicsAndSound.en.md#11149"
  - 
    title: "The Structure of Graphics"
    link: "https://reference.wolfram.com/language/tutorial/TheStructureOfGraphicsAndSound.en.md#11957"
---
# LABColor

LABColor[l, a, b] represents a color in the CIELAB color space with lightness l and color components a and b. 

LABColor[l, a, b, α] specifies opacity α. 

LABColor["string"] returns a color from an HTML color name etc.

LABColor[color] returns the CIELAB representation of color.

## Details

* ``LABColor`` is a color space that expresses colors as a level of perceptual lightness ``l``, a red-green component ``a`` and a yellow-blue component ``b``, composing the four unique colors in human vision.

* ``LABColor`` is designed to have perceptual uniformity; i.e. equal changes in its components will be perceived by a human to have equal effects.

[image]

* ``LABColor`` is the basis for ``ColorDistance``.

* ``LABColor`` is device independent and corresponds to the CIE 1976 $L^ * a^ * b^ * $ color space with ${l, a, b} = {L^ * , a^ * , b^ * } / 100$.

* The parameters have the following interpretation:

|   |                                               |
| - | --------------------------------------------- |
| l | lightness or approximate luminance            |
| a | color, green (negative) to magenta (positive) |
| b | color, blue (negative) to yellow (positive)   |

* The parameters $L^ * $, $a^ * $ and $b^ * $ are given by $L^ * =116 f(y / Subscript[y, n]) - 16$, $a^ * =500 (f(x / Subscript[x, n]) - f(y / Subscript[y, n]))$ and $b^ * =200 (f(y / Subscript[y, n]) - f(z / Subscript[z, n]))$, where $x$, $y$ and $z$ are color parameters, $Subscript[x, n]$, $Subscript[y, n]$ and $Subscript[z, n]$ are white point parameters in ``XYZColor``, and $f(t)$ is a piecewise function that is equal to $t^(1/(3))$ for $t > (6 / 29)^3$ and $(1/3) (29 / 6)^2 t + 4 / 29$ for $t ≤ (6 / 29)^3$.

* ``ColorConvert`` can be used to convert ``LABColor`` to other color spaces.

* ``LABColor`` allows any real number for ``l``, ``a``, and ``b``.

* ``RGBColor`` approximately corresponds to ``l`` between 0 and 1, ``a`` between $-0.8$ and $0.94$, and ``b`` between $-1.13$ and $0.94$.

* If no opacity has been specified, ``LABColor[l, a, b]`` is equivalent to ``LABColor[l, a, b, 1]``.

* ``LABColor[l, a, b, α]`` is equivalent to ``{LABColor[l, a, b], Opacity[α]}``.

* The alternative forms ``LABColor[{l, a, b}]`` and ``LABColor[{l, a, b, α}]`` can also be used. »

* ``{````LABColor````[…]````, ```` p1````, ```` …````}`` indicates that graphics primitives ``pi`` should be displayed in the color given.

* The following wrappers can be used around colors:

|                        |                                                           |
| ---------------------- | --------------------------------------------------------- |
| ColorsNear[color, …]   | specifies a region around color                           |
| Directive[…, color, …] | specifies a color in combination with other directives  » |
| Glow[color]            | specifies color independent of lighting  »                |
| Opacity[a, color]      | specifies a color with an opacity a                       |
| Style[expr, color]     | displays expr with the specified color  »                 |

* For 3D surfaces, explicit ``LABColor`` directives define surface colors; the final shading depends on lighting and contributions from specularity and glow. »

---

## Examples (15)

### Basic Examples (4)

Specify the color of graphics primitives:

```wl
In[1]:= Graphics[{LABColor[.5, .8, .8], Disk[]}]

Out[1]= [image]
```

---

Specify the color with opacity:

```wl
In[1]:= Graphics3D[{LABColor[.5, 1, .6, .5], Sphere[]}]

Out[1]= [image]
```

---

Specify the output color of expressions:

```wl
In[1]:= Style[x ^ 2 + y ^ 2, LABColor[.5, 1 / 2, 1 / 2]]

Out[1]= x^2 + y^2
```

---

Specify the color of plots:

```wl
In[1]:= Plot[Sin[x ^ 2], {x, 0, 2Pi}, PlotStyle -> LABColor[.6, .5, 1]]

Out[1]= [image]
```

### Scope (3)

#### Colors in 3D (1)

Use diffuse surface color:

```wl
In[1]:= Graphics3D[{LABColor[.4, 1, 0], Sphere[]}]

Out[1]= [image]
```

Use diffuse and specular surface color:

```wl
In[2]:= Graphics3D[{LABColor[.4, 1, 0], Specularity[White, 20], Sphere[]}]

Out[2]= [image]
```

Use glow color, setting the diffuse surface color to black:

```wl
In[3]:= Graphics3D[{Black, Glow[LABColor[.4, 1, 0]], Sphere[]}]

Out[3]= [image]
```

#### Color Operations (2)

Use ``Blend`` to mix two or more colors:

```wl
In[1]:=
{Graphics[{LABColor[.5, 1, 0], Disk[]}], Graphics[{Blend[{LABColor[.5, 1, 0], LABColor[1, 0, 1]}], Disk[]}], 
	Graphics[{LABColor[1, 0, 1], Disk[]}]}

Out[1]= {[image], [image], [image]}
```

---

Use ``Lighter`` and ``Darker`` to mix with white and black, respectively:

```wl
In[1]:=
{Graphics[{Lighter[LABColor[0.5, 0.8, 0.7], .4], Disk[]}], 
	Graphics[{LABColor[0.5, 0.8, 0.7], Disk[]}], 
	Graphics[{Darker[LABColor[0.5, 0.8, 0.7], .4], Disk[]}]}

Out[1]= {[image], [image], [image]}
```

### Generalizations & Extensions (2)

``LABColor[{l, a, b}]`` is equivalent to ``LABColor[l, a, b]`` :

```wl
In[1]:= {Graphics[{LABColor[{1, 1, 0}], Disk[]}], Graphics[{LABColor[1, 1, 0], Disk[]}]}

Out[1]= {[image], [image]}

In[2]:= Map[Graphics[{LABColor[#], Disk[]}]&, {{1, 0, 1}, {1, 1, 0}, {1, -1, 0}}]

Out[2]= {[image], [image], [image]}
```

---

Use ``Opacity`` with ``LABColor`` :

```wl
In[1]:= Table[Graphics[{Orange, Disk[{1, 0}], Opacity[a], LABColor[1 / 2, 1 / 2, 1 / 3], Disk[]}], {a, 0, 1, .33}]

Out[1]= {[image], [image], [image], [image]}
```

Use the opacity argument in ``LABColor`` directly:

```wl
In[2]:= Table[Graphics[{Orange, Disk[{1, 0}], LABColor[1 / 2, 1 / 2, 1 / 3, a], Disk[]}], {a, 0, 1, .33}]

Out[2]= {[image], [image], [image], [image]}
```

### Applications (2)

Define a color negation using ``LABColor``:

```wl
In[1]:= i = [image];
```

``ColorNegate`` by default operates using ``RGBColor``:

```wl
In[2]:= ColorNegate[i]

Out[2]= [image]
```

If color negation is defined as ``LABColor[l, -a, -b]`` the lightness is preserved:

```wl
In[3]:= ImageApply[{#[[1]], -#[[2]], -#[[3]]}&, ColorConvert[i, "LAB"]]

Out[3]= [image]
```

---

Show a bubble chart of color distribution using the a and b channels of the CIELAB color space:

```wl
In[1]:= i = [image];

In[2]:= BubbleChart[Append@@@Tally[Round[Flatten[ImageData[ColorConvert[i, "LAB"]], 1][[All, {2, 3}]], 10 ^ -1]], ColorFunction -> (LABColor[.6, ##]&), ColorFunctionScaling -> False, BubbleSizes -> {0.01, 0.1}]

Out[2]= [image]
```

A 3D bubble chart:

```wl
In[3]:= BubbleChart3D[Append@@@Tally[Round[Flatten[ImageData[ColorConvert[i, "LAB"]], 1], 10 ^ -1]], ColorFunction -> LABColor, ColorFunctionScaling -> False, BubbleSizes -> {0.01, 0.1}]

Out[3]= [image]
```

### Properties & Relations (3)

The RGB gamut in CIELAB color space:

```wl
In[1]:= ChromaticityPlot3D["RGB", "LAB"]

Out[1]= [image]
```

---

``Blend`` of ``LABColor`` directives happens in the CIELAB parameter space:

```wl
In[1]:=
{c1, c2} = {LABColor[1, 0, 1], LABColor[0.5, 1, 0]};
Blend[{c1, c2}]
%//InputForm

Out[1]= LABColor[0.75, 0.5, 0.5]
```

Out[1]//InputForm= LABColor[0.75, 0.5, 0.5]

```wl
In[2]:= Table[Graphics[{color, Disk[]}], {color, {c1, Blend[{c1, c2}], c2}}]

Out[2]= {[image], [image], [image]}
```

---

``ColorDistance`` by default computes the ``EuclideanDistance`` in the CIELAB color space:

```wl
In[1]:= {c1, c2} = {LABColor[1, 0, 1], LABColor[0.5, 1, 0]};

In[2]:= {EuclideanDistance[List@@c1, List@@c2], ColorDistance[c1, c2]}

Out[2]= {1.5, 1.5}
```

### Neat Examples (1)

Visualizing the $L^ * a^ * b^ * $ color space:

```wl
In[1]:= Graphics3D[{Opacity[.7], {LABColor[#], Cuboid[#, # + {.1, .2, .2}]}& /@ Tuples[{Range[0, 1, .2], Range[-1, 1, .4], Range[-1, 1, .4]}]}, Axes -> True, AxesLabel -> {"L", "a", "b"}, Lighting -> "Neutral", BoxRatios -> 1]

Out[1]= [image]
```

## See Also

* [`RGBColor`](https://reference.wolfram.com/language/ref/RGBColor.en.md)
* [`LCHColor`](https://reference.wolfram.com/language/ref/LCHColor.en.md)
* [`LUVColor`](https://reference.wolfram.com/language/ref/LUVColor.en.md)
* [`XYZColor`](https://reference.wolfram.com/language/ref/XYZColor.en.md)
* [`ThemeColor`](https://reference.wolfram.com/language/ref/ThemeColor.en.md)
* [`Opacity`](https://reference.wolfram.com/language/ref/Opacity.en.md)
* [`Blend`](https://reference.wolfram.com/language/ref/Blend.en.md)
* [`Lighter`](https://reference.wolfram.com/language/ref/Lighter.en.md)
* [`ColorConvert`](https://reference.wolfram.com/language/ref/ColorConvert.en.md)
* [`ColorDistance`](https://reference.wolfram.com/language/ref/ColorDistance.en.md)
* [`DominantColors`](https://reference.wolfram.com/language/ref/DominantColors.en.md)
* [`BrightnessEqualize`](https://reference.wolfram.com/language/ref/BrightnessEqualize.en.md)

## Tech Notes

* [Three-Dimensional Graphics Directives](https://reference.wolfram.com/language/tutorial/TheStructureOfGraphicsAndSound.en.md#11149)
* [The Structure of Graphics](https://reference.wolfram.com/language/tutorial/TheStructureOfGraphicsAndSound.en.md#11957)

## Related Guides

* [`Colors`](https://reference.wolfram.com/language/guide/Colors.en.md)
* [Color Processing](https://reference.wolfram.com/language/guide/ColorProcessing.en.md)
* [Image Computation: Update History](https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md)

## History

* [Introduced in 2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) \| [Updated in 2021 (12.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn123.en.md)