PERGOLA LOGO

Color

Utility functions for manipulation of colors.

pergola.color

PROPERTIES

pergola.color.rgbTable

Array; table of 65536 rgb color values in basic mode, or 393216 rgb color values in extended mode. The rgbTablePopulate.basic() and rgbTablePopulate.extended() methods are invoked by the pergola.colorpicker layout_narrow() and layout_wide() methods when toggling between basic (65536 visible colors) and axtended mode (393216 visible colors).

pergola.color.neutral

Boolean; true if the current theme color is neutral.

pergola.color.components

Object with r, g and b number properties representing the components of to the current theme color.

pergola.color.ingredients

Array with sorted color number values of the current theme color.

pergola.color.themeLuminosity

Number; the luminosity (0–255) of the current theme color.

pergola.color.keywordNames

Object; the color keywords table with name/value pairs.

pergola.customColorNames

Object defining custom color keywords. Located in skins.js file.

METHODS

hslToRgb(h, s, l)

h, s and l are numbers representing the respective values. Returns an array of [r, g, b] values.

convert(c[, format])

Converts c string specified in any legal format (including keyword and custom keyword names). If format string is specified ("rgb" or "hex") the method returns the formatted string in the specified format, otherwise it returns an array with the [r, g, b] values.

hexToRGB(c)

c is a hexadecimal color string (with the "#" sign). Returns an array of [r, g, b] values.

rgbToHex(n)

n is a number in the range 0–255. Returns two hex digits in the range 00–FF. If the result overflows, the return value is constrained to FF.

lab()

Used by system to define pergola.color.neutral, pergola.color.components, pergola.color.ingredients, and pergola.color.themeLuminosity. These properties are used to determine the color scheme of the interface based on the current color theme and to produce shades. This method must not be invoked explicitly.

shade(cents[, f])

Produces a shade of current theme color from the values specified in the cents array. The cents values can affect hue and/or saturation. If f number is specified (positive or negative) the brightness is corrected by the f factor.

pergola.color.rgbTablePopulate

basic()

Populates an array with 65536 rgb colors. Used by pergola.ColorPicker. You don't normally need to invoke this method explicitly.

extended()

Populates an array with 393216 rgb colors. Used by pergola.ColorPicker in extended mode. You don't normally need to invoke this method explicitly.