Skip to content
colors

labToRgb

The `labToRgb` function converts CIE Lab color values back into the RGB color model. It performs Lab → XYZ → RGB transformations and outputs red, green, and blue values as integers between 0 and 255.

1 min read154 words

Function Signature

js

labToRgb(L: number, a: number, b: number): { r: number, g: number, b: number }

Parameters

  • L (number): Lightness component (0–100).
  • a (number): Green–red axis (typically ~ -128 to +127).
  • b (number): Blue–yellow axis (typically ~ -128 to +127).

Return Value

An object with RGB components (r, g, b) as integers in the range 0–255.

js

labToRgb(62, 58, 70);
// { r: 255, g: 102, b: 0 }

labToRgb(66, -7, -41);
// { r: 0, g: 170, b: 255 }

labToRgb(100, 0, 0);
// { r: 255, g: 255, b: 255 }

labToRgb(0, 0, 0);
// { r: 0, g: 0, b: 0 }

Conversion Details

  • Uses D65 reference white (Xn = 95.047, Yn = 100.0, Zn = 108.883).
  • Intermediate step converts Lab → XYZ, then XYZ → linear RGB.
  • Applies gamma correction (linearToSrgb) to produce final sRGB values.
  • RGB values are clamped to the range 0–255.

Examples

js

// Bright red
console.log(labToRgb(53, 80, 67));
// { r: 255, g: 0, b: 0 }

// Forest green
console.log(labToRgb(50, -47, 45));
// { r: 34, g: 139, b: 34 }

Usage Notes

  • The function ensures perceptually accurate Lab → RGB conversion.
  • Useful for reversing rgbToLab transformations when working with perceptual color differences.
  • Values outside of the displayable RGB gamut are clamped automatically.

Previous

rgbToLab

Next

rgbToOklab


Top tools

WorkspaceLinksySEO AnalyzerChromoQR Code Generator

ReadyTools

CareersContactTools
Pricing7 days free
SupportSecurityGuidesDocsBlogUpdatesLaraVault

Select Language

Set theme

ReadyTools

© 2026 ReadyTools. All rights reserved.