# Parsing


```ts
import { parse, isValidColor } from "chroma-panel";

parse("#3366cc");
parse("rgb(51 102 204)");
parse("hsl(220 60% 50%)");
parse("hwb(220 20% 20%)");

isValidColor("not a colour"); // false
```

Hex (3, 4, 6 and 8 digit), `rgb()`, `rgba()`, `hsl()`, `hsla()`, `hwb()` and the
modern space-separated forms are all accepted.

## API reference

<SignatureList names="parse, isValidColor" />

## Merging rather than replacing

`ingest` is what the panel uses internally. It merges a change into a full HSVA
value instead of replacing it, which is what preserves hue and saturation at the
extremes — see [converting](/react/utils/converting).

<Signature name="ingest" />

## Named colors

`parse("rebeccapurple")` returns null until you register the names. They cost
about 1.3 kB gzipped, so they are opt-in — see
[named colors](/react/utils/named-colors).
