Reference Source
public class | source

ColorUtil

You can directly use an instance of this class. colorUtil

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

extractHsv(colorString: String): {"h": *, "s": *, "v": *}

Utility function to extract h,s and v from a color string.

public

formatColorString(color: String, format: String): *

Utility function to convert a color into a desired format.

public

getHue(colorString: String): *

Utility function to extract hue.

public

getValidFormats(formats: Array): *

Utility function to validate given formats in supported formats and return a list of formats.

public

toHslString(hue: String, colorString: String): *

Utility function to convert a color to Hsl string.

public

toHsvString(hue: String, colorString: String): *

Utility function to convert a color to Hsv string.

Public Constructors

public constructor() source

Public Methods

public extractHsv(colorString: String): {"h": *, "s": *, "v": *} source

Utility function to extract h,s and v from a color string.

Params:

NameTypeAttributeDescription
colorString String

The color string

Return:

{"h": *, "s": *, "v": *}

public formatColorString(color: String, format: String): * source

Utility function to convert a color into a desired format.

Params:

NameTypeAttributeDescription
color String

The color string

format String

A color format

Return:

*

public getHue(colorString: String): * source

Utility function to extract hue.

Params:

NameTypeAttributeDescription
colorString String

The color string

Return:

*

public getValidFormats(formats: Array): * source

Utility function to validate given formats in supported formats and return a list of formats. Any invalid/unsupported format is ignored.

Params:

NameTypeAttributeDescription
formats Array

An array of formats to validate

Return:

*

public toHslString(hue: String, colorString: String): * source

Utility function to convert a color to Hsl string.

Params:

NameTypeAttributeDescription
hue String

The hue value which is preserved in color conversion.

colorString String

The color string

Return:

*

public toHsvString(hue: String, colorString: String): * source

Utility function to convert a color to Hsv string.

Params:

NameTypeAttributeDescription
hue String

The hue value which is preserved in color conversion.

colorString String

The color string

Return:

*