OGE logoOGE

Color Gradient

The color box's picker surfaces as an always-visible form editor — Kendo's ColorGradient: a saturation/brightness surface, hue and optional alpha sliders, hex + R/G/B(/A) inputs and an optional WCAG contrast readout against a background you choose. No APG color-picker pattern exists, so it is a labelled role="group" of APG sliders (the surface is a 2-axis role="slider" with mandatory aria-valuetext) and native inputs.

Works standalone via [(value)], with Signal Forms via [formField], and with reactive/template forms via formControl/ngModel. Need it in a drop-down? That is the color box.

inline picker WCAG contrast Signal Forms alpha

Getting started

Surface, hue slider and channel inputs, each its own Tab stop. Dragging commits live and flushes on release; Escape mid-drag restores the start color. The hue survives a pass through gray — the working color keeps its own HSV.

value role=group live commit

Value: #3aa0ff

Alpha and formats

editAlphaChannel adds the alpha slider and percent input; format: 'hex' | 'rgb' | 'rgba' | 'hsl' fixes the committed string, widening to carry alpha when the color is translucent. showInputs: false keeps only the surface and sliders.

editAlphaChannel format showInputs

Overlay: rgba(58, 160, 255, 0.5) — Compact: hsl(160, 84%, 39%)

Contrast checker

showContrast renders the WCAG readout — the ratio of the current color against contrastBackground (translucent colors are composited over it first) with AA (4.5:1) and AAA (7:1) verdicts. A failing 4.499 never displays as a pass. The math is exported as contrastRatio() / contrastLevels().

showContrast contrastBackground AA / AAA
Contrast4.54:1 AA pass AAA fail
Contrast5.70:1 AA pass AAA fail

Inside a form

A FormValueControl and a ControlValueAccessor like every editor in the family: [formField], formControl and ngModel all bind it, and touched/dirty/disabled follow the bound field.

FormValueControl CVA

Model: #7c3aed