Convert a Lab color to an LCH color

Turn a and b into chroma and hue degrees.

JavaScript Version 1.0.0 · MIT · .md

convert-a-lab-color-to-an-lch-color.js
function labToLch([l, a, b]) { return [l, Math.hypot(a, b), ((Math.atan2(b, a) * 180) / Math.PI + 360) % 360]; }

Input & expected output

Input

[
  52,
  40,
  30
]

Expected output

[
  52,
  50,
  36.86989764584405
]

The edge case

Input

[
  50,
  0,
  -10
]

Expected output

[
  50,
  10,
  270
]

Know the limits

  • Hue is normalized to 0–360°; the original could return negative hues, as the edge case would.
  • Assumes CIE Lab input; it does not convert from sRGB.

The function above is the implementation used by the lab. The lab validates JSON types and caps size before execution; include equivalent validation when accepting untrusted input in your application.

Source & maintenance

Based on Convert a LAB color to an LCH color from the original 1loc collection by Nguyen Huu Phuoc. Copyright (c) 2020 phuoc-ng. MIT licensed.

Uses Math.hypot and normalizes hue to 0–360 degrees. Original MDX retained as inert source evidence.

Maintained by Oveyon. Source commit: 14b481cf60df. Read the license.

Local fixture scope · Node.js 22.23.2 · reviewed October 28, 2026. No external service is required.

Keep exploring

Type two or more characters. Try “duplicate”, “webhook” or “retry”.