# Color

CSS variables and oklch() turned into something three.js can parse, so the WebGL robots share one theme with the SVG ones.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/robot-color.json
```

Registry item: `robot-color` · [`https://robocn.dev/r/robot-color.json`](https://robocn.dev/r/robot-color.json)

## API

| name | type | default | description |
| --- | --- | --- | --- |
| `resolveCssColor` | `(value, fallback?, context?) => string` | — | Resolves var() against the document and converts oklch to hex. Returns the fallback while server-rendering. |
| `oklchToHex` | `(input: string) => string | null` | — | oklch() and oklab() to #rrggbb, in code rather than through the DOM. |

## Source

- `src/lib/robocn/color.ts`
