# ui/colorgrid/utils

module

<a id="interfaces">

## Interfaces

<a id="interface-NormalizedColorOption">

### `NormalizedColorOption`

<a id="type-definitions">

## Type Definitions

<a id="typedef-ColorOption">

### `ColorOption`

<a id="functions">

## Functions

<a id="function-getLocalizedColorName">

### `getLocalizedColorName( locale, label ) → string` _(internal)_

Returns the localized name of a color, as displayed next to a color tile or in a suggestion description.

Labels of shaded palettes follow the `<hue> <shade>` pattern, for instance `Blue grey 700`. Such a label is translated hue by hue, so a palette built of shades does not need a dictionary entry for every shade. A label whose hue is unknown is returned unchanged.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-ui/src/colorgrid/utils.ts#L67)

#### Parameters

* `locale: Locale`

  The [`locale`](module_core_editor_editor-Editor.md#member-locale) instance.

* `label: string`

  The color label to translate.

#### Returns

* `string`

<a id="function-getLocalizedColorOptions">

### `getLocalizedColorOptions( locale, options ) → Array<NormalizedColorOption>`

Returns color configuration options as defined in `editor.config.(fontColor|fontBackgroundColor).colors` or \`editor.config.table.(tableProperties|tableCellProperties).(background|border).colors but processed to account for editor localization in the correct language.

Note: The reason behind this method is that there is no way to use [`t`](module_utils_locale-Locale.md#member-t) when the user configuration is defined because the editor does not exist yet.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-ui/src/colorgrid/utils.ts#L43)

#### Parameters

* `locale: Locale`

  The [`locale`](module_core_editor_editor-Editor.md#member-locale) instance.

* `options: Array<NormalizedColorOption>`

#### Returns

* `Array<NormalizedColorOption>`

<a id="function-normalizeColorOptions">

### `normalizeColorOptions( options ) → Array<NormalizedColorOption>`

Creates a unified color definition object from color configuration options. The object contains the information necessary to both render the UI and initialize the conversion.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-ui/src/colorgrid/utils.ts#L121)

#### Parameters

* `options: Array<ColorOption>`

#### Returns

* `Array<NormalizedColorOption>`

<a id="function-normalizeSingleColorDefinition">

### `normalizeSingleColorDefinition( color ) → NormalizedColorOption`

Creates a normalized color definition from the user-defined configuration. The "normalization" means it will create full [`ColorDefinition-like`](module_ui_colorgrid_colorgridview-ColorDefinition.md) object for string values, and add a `view` property, for each definition.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-ui/src/colorgrid/utils.ts#L133)

#### Parameters

* `color: ColorOption`

#### Returns

* `NormalizedColorOption`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
