Sign up (with export icon)

ui/colorgrid/utils

Api-module iconmodule

Interfaces

Type Definitions

Functions

  • Chevron-right icon

    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.

    Parameters

    locale: Locale

    The locale instance.

    label: string

    The color label to translate.

    Returns

    string
  • Chevron-right icon

    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 when the user configuration is defined because the editor does not exist yet.

    Parameters

    locale: Locale

    The locale instance.

    options: Array<NormalizedColorOption>

    Returns

    Array<NormalizedColorOption>
  • Chevron-right icon

    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.

    Parameters

    options: Array<ColorOption>

    Returns

    Array<NormalizedColorOption>
  • Creates a normalized color definition from the user-defined configuration. The "normalization" means it will create full ColorDefinition-like object for string values, and add a view property, for each definition.

    Parameters

    color: ColorOption

    Returns

    NormalizedColorOption