Source: https://guthlabs.ai/docs/instruments/hex-rgb-hsl-lab-color-converter/implementation/

instrument implementation / implementation-contract

# Hex ↔ RGB ↔ HSL ↔ LAB Color Converter implementation

A source-bound implementation contract for Hex ↔ RGB ↔ HSL ↔ LAB Color Converter; deployment and executable qualification remain separate.

Status: **VERIFIED_CLEAN**Lifecycle: **implementation-contract**

## Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

**Record owner**: Guth Instruments

**Lifecycle**: verified-clean

**Evidence ID**: t5-012

**Effect**: Computation or source lookup only

## Input and validation requirements

The achromatic gray vector exposes a real undefined intermediate: HSL and HSV hue formulas contain division by delta, and delta is exactly zero for #808080. An implementation that does not special-case achromatic colors can produce NaN or an invalid swatch instead of returning hue=0 by convention or explicitly reporting undefined.

## Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

## Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

````
{
  "inputs": {
    "hex": "#000000",
    "rgb_8bit": {
      "r": 0,
      "g": 0,
      "b": 0
    }
  },
  "expected_outputs": {
    "rgb_normalized": {
      "r": 0,
      "g": 0,
      "b": 0
    },
    "hsl": {
      "h_deg": 0,
      "s": 0,
      "l": 0
    },
    "hsv": {
      "h_deg": 0,
      "s": 0,
      "v": 0
    },
    "lab": {
      "L": 0,
      "a": 0,
      "b": 0
    },
    "cmyk": {
      "c": 0,
      "m": 0,
      "y": 0,
      "k": 1
    }
  },
  "working": "Hex #000000 gives R=G=B=0, so normalized RGB=(0/255,0/255,0/255)=(0,0,0). HSL: max=min=0, so L=(0+0)/2=0 and S=0; hue is conventionally 0 for zero saturation. HSV: V=max=0 and S=0; hue is conventionally 0. Linear RGB=(0,0,0), therefore XYZ=(0,0,0). Since each XYZ component is below epsilon, f(t)=kappa*t, giving L*=0, a*=0, b*=0. CMYK: K=1-max(0,0,0)=1; C=M=Y=0 by the K=1 special case."
}
````

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/hex-rgb-hsl-lab-color-converter/>)[02**Mechanism**](<https://guthlabs.ai/docs/instruments/hex-rgb-hsl-lab-color-converter/mechanism/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/hex-rgb-hsl-lab-color-converter/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`
