# cssColor

function in `@dioramajs/diorama/render`

```ts
import { cssColor } from '@dioramajs/diorama/render'
```

Any CSS colour as '#rrggbb', which three's `Color.setStyle` parses. Alpha is dropped. Hex,
rgb() and hsl() in both syntaxes and colour names are parsed here; other colour spaces go
through a canvas, so they need a browser. Undefined for what is not a colour.

With `element`, `var(--brand)` (its fallback when unset, nested custom properties followed)
and `currentColor` are read from the element's computed style, anywhere in the value, as in
`color-mix(in oklab, var(--brand), white)`. The value is read at the call: call again to see a
changed variable.

```ts
function cssColor(value: string, element?: Element): string | undefined
```

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` |  |
| `element?` | `Element` |  |

Also exported from `@dioramajs/render`.

Defined in [packages/render/src/color.ts](https://github.com/MasterKurosava/diorama/blob/main/packages/render/src/color.ts#L136).
