Import
import { NuiColorPicker, nuiParseColor } from '@needless-ui/angular/color-picker';NuiColorPicker
A color picker in OKLCH.
| Name | Type | Default | Description |
|---|---|---|---|
valueTwo-way | string | '' | The color, written in the format. Empty until one is picked. |
formatTwo-way | 'hex' | 'rgb' | 'hsl' | 'oklch' | 'p3' | 'hex' | How the value is written. |
formatsInput | NuiColorFormat[] | hex, rgb, hsl, oklch | The formats the format button goes through. |
gamutInput | 'srgb' | 'p3' | 'srgb' | The colors the area holds: sRGB, or Display P3. |
alphaInput | boolean | true | Shows the opacity slider. |
swatchesInput | NuiColorSwatch[] | [] | Colors to pick from, with names. |
contrastWithInput | string | A background to check the contrast against. | |
eyeDropperInput | boolean | true | Shows the eyedropper, where the browser has one. |
disabledInput | boolean | false | It can’t be changed. |
labelsInput | Partial<NuiColorPickerLabels> | Every text it says, to translate. | |
colorProperty | Signal<NuiColor> | The color picked, in OKLCH. |
Helpers
Functions for colors.
| Name | Type | Default | Description |
|---|---|---|---|
nuiParseColorMethod | (text: string) => NuiColor | null | Reads a color in any CSS syntax. | |
nuiFormatColorMethod | (color, format?) => string | Writes a color in a format. | |
nuiToGamutMethod | (color, gamut?: 'srgb' | 'p3') => NuiColor | Brings a color into sRGB or Display P3, as CSS does. | |
nuiContrastMethod | (color, background) => number | The WCAG 2 contrast ratio of a color on a background. |