# disko:color

> Mix, lighten, darken and fade colours made with rgb, rgba, hsl and hsla.

Import with `import { mix } from "disko:color"`. Generated from the module's
shipped declarations. Colours themselves come from the
[colour functions](/reference/game#colour-functions); see
[Drawings](/games/drawings) for a guide.

`disko:color` — working with colours: mixing, lightening, darkening and changing transparency.

Colours are the frozen `{ r, g, b, a }` values that the `rgb`, `rgba`, `hsl` and `hsla` globals make. Every function returns a new colour, accepted wherever a colour is: drawings, UI styles and chat.

Mistakes throw where they are made: `TypeError` for a value that is not a colour, `RangeError` for an amount or alpha outside 0–1.

## Functions

### mix

The colour `t` of the way from `from` to `to`, alpha included.

```ts
export function mix(from: Disko.Color, to: Disko.Color, t: number): Disko.Color;
```

### lighten

`color` moved `by` (0–1) of the way toward white.

```ts
export function lighten(color: Disko.Color, by: number): Disko.Color;
```

### darken

`color` moved `by` (0–1) of the way toward black.

```ts
export function darken(color: Disko.Color, by: number): Disko.Color;
```

### withAlpha

`color` with alpha `a`, from 0 (clear) to 1 (opaque).

```ts
export function withAlpha(color: Disko.Color, a: number): Disko.Color;
```
