# ColorUtils

**Kind:** Interface

Utilities for working with `Color` names from the `colors` enum.

## Methods

### `getHexForColor(colorString)`

Given a `Color`, return the hex color value for that color, or null if the value isn't a `Color`

**Parameters:**
- `colorString` (`Color`)

**Returns:** `string`

```js
import {colorUtils, colors} from '@airtable/blocks/interface/ui';

colorUtils.getHexForColor(colors.RED);
// => '#ef3061'

colorUtils.getHexForColor('uncomfortable beige');
// => null
```

### `getRgbForColor(colorString)`

Given a `Color`, return an `RGB` object representing it, or null if the value isn't a `Color`

**Parameters:**
- `colorString` (`Color`)

**Returns:** `RGB`

```js
import {colorUtils, colors} from '@airtable/blocks/interface/ui';

colorUtils.getRgbForColor(colors.PURPLE_DARK_1);
// => {r: 107, g: 28, b: 176}

colorUtils.getRgbForColor('disgruntled pink');
// => null
```

### `shouldUseLightTextOnColor(colorString)`

Given a `Color`, returns true or false to indicate whether that color should have light text on top of it when used as a background color.

**Parameters:**
- `colorString` (`string`)

**Returns:** `boolean`

```js
import {colorUtils, colors} from '@airtable/blocks/interface/ui';

colorUtils.shouldUseLightTextOnColor(colors.PINK_LIGHT_1);
// => false

colorUtils.shouldUseLightTextOnColor(colors.PINK_DARK_1);
// => true
```
