Geoportal Extension for OpenLayers
API Reference

Module: ColorUtils

module:~utils/ColorUtils

...

Example

import ColorUtils from "gpf-ext-ol/utils/ColorUtils"
ou 
import {ColorUtils} from "gpf-ext-ol

ColorUtils.hex();
ColorUtils.num();
ColorUtils.arrayTorgba();
ColorUtils.arrayToHex();
ColorUtils.rgbaToHex();
ColorUtils.hexToRgba();
ColorUtils.isHex();
ColorUtils.isRGB();

Methods

innerarrayToHex(values){Object}

Utils/ColorUtils.js, line 66

Converts an array ([255,255,255,1]) to #RRGGBBAA

Name Type Description
values Array

array of values

Returns:
and opacity formated values

innerarrayToRgba(values){String}

Utils/ColorUtils.js, line 47

Converts an array ([255,255,255,1]) to rgba string

Name Type Description
values Array

array of values

Returns:
color of RGB or RGBA format

innerhexToRgba(hex, opacity){String}

Utils/ColorUtils.js, line 119

Converts hex color and opacity value to rgba string.
(Code adapted from : http://stackoverflow.com/a/5624139)

Name Type Description
hex String

A color value on RGB format (hexa).

opacity Number

A opacity value.

Returns:
color of RGB or RGBA format

innerrgbaToHex(rgba){Object}

Utils/ColorUtils.js, line 91

Converts rgba string to #RRGGBBAA
(Code adapted from : https://gist.github.com/mstssk/afda4ce9e5c335fd79cd)

Name Type Description
rgba String

A color of RGB or RGBA format.

Returns:
and opacity formated values