ui/colorgrid/utils
Interfaces
module:ui/colorgrid/utils~NormalizedColorOption
Type Definitions
module:ui/colorgrid/utils~ColorOption
Functions
getLocalizedColorName( locale, label ) → stringinternalmodule:ui/colorgrid/utils~getLocalizedColorNameReturns 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 instanceBlue 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
Returns
string
getLocalizedColorOptions( locale, options ) → Array<NormalizedColorOption>module:ui/colorgrid/utils~getLocalizedColorOptionsReturns color configuration options as defined in
editor.config.(fontColor|fontBackgroundColor).colorsor `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
twhen the user configuration is defined because the editor does not exist yet.Parameters
locale: LocaleThe
localeinstance.options: Array<NormalizedColorOption>
Returns
Array<NormalizedColorOption>
normalizeColorOptions( options ) → Array<NormalizedColorOption>module:ui/colorgrid/utils~normalizeColorOptionsCreates 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>
module:ui/colorgrid/utils~normalizeSingleColorDefinitionCreates a normalized color definition from the user-defined configuration. The "normalization" means it will create full
ColorDefinition-likeobject for string values, and add aviewproperty, for each definition.Parameters
color: ColorOption
Returns