colors
pg_colors · C functions for perceptual color-distance calculations in the CIE Lab* color space
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100229 | colors | pg_colors | 0.0.1 | FUNC | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
colors 0.0.1 adds four perceptual color-distance calculations for pairs of CIE Lab* coordinates. Use it when colors have already been converted to the same CIELAB white-point and observer convention; the extension does not convert RGB/XYZ values or carry color-management metadata.
Core Workflow
Install the extension, then pass the six L*, a*, and b* coordinates as double precision values:
Smaller results mean the samples are closer under the selected formula. Pick one formula for a workflow and keep its parameters stable; values from different formulas are not directly interchangeable.
Function Index
delta_e_cie_1976(...)implements the six-coordinate CIE76 Euclidean distance.delta_e_cie_1994(...)has a six-coordinate overload with graphic-arts defaults and an eleven-argument overload exposing the weighting constants.delta_e_cmc(...)has a six-coordinate overload with the 2:1 acceptability defaults and an eight-argument overload exposing the lightness and chroma weights.delta_e_cie_2000(...)has a six-coordinate overload and a nine-argument overload exposing the lightness, chroma, and hue weights.
All functions are strict and immutable and return double precision.
Operational Notes
The implementation neither validates the physical range of the coordinates nor transforms between color spaces. Normalize data before comparison and test the chosen formula against domain reference samples. The source is an old, small C implementation, so verify it on the exact PostgreSQL build and include edge cases in numerical regression tests.