# toHex

Formats a colour as `#rrggbb`, or `#rrggbbaa` when it is translucent.

This is a function exported by `@mapcairn/theme`, checked against version 0.2.0.

## Signature

```ts
import { toHex } from "@mapcairn/theme";
 
function toHex(colour: Rgba): string;
```

## Parameters

- `colour` (`Rgba`)

## Returns

`string`

## See also

- [`Rgba`](https://docs.mapcairn.com/api/theme/Rgba.md)

Source: [packages/theme/src/contrast.ts:370](https://github.com/MapCairn/mapcairn/blob/main/packages/theme/src/contrast.ts#L370)
