ColorUtils
On this page
ColorUtils ⇐ Class
Kind: global class
Extends: Class
- ColorUtils ⇐
Class- new ColorUtils()
- .toHexARGB(color, format) ⇒
string - .toHexRGBA(color, format) ⇒
string - .toHexRGB(color, format) ⇒
string - .toRGBA(color, format) ⇒
string - .toRGB(color, format) ⇒
string - .toNumberARGB(color, format) ⇒
number - .toNumberRGBA(color, format) ⇒
number - .toNormalizedRGBA(color, format) ⇒
Object
ColorUtils()
Color utility methods as a static class.
toHexARGB(color, format) ⇒ string
transform color to hex argb string ("#AARRGGBB")
Kind: static method of ColorUtils
Returns: string - hex ARGB string ("#AARRGGBB")
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toHexRGBA(color, format) ⇒ string
transform color to hex rgba string ("#RRGGBBAA")
Kind: static method of ColorUtils
Returns: string - hex RGBA string ("#RRGGBBAA")
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toHexRGB(color, format) ⇒ string
transform color to hex rgb string ("#RRGGBB")
Kind: static method of ColorUtils
Returns: string - hex RGB string ("#RRGGBB")
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toRGBA(color, format) ⇒ string
transform color to rgba string (“rgba(255,255,255,1)”)
Kind: static method of ColorUtils
Returns: string - rgba string (“rgba(255,255,255,1)”)
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toRGB(color, format) ⇒ string
transform color to rgb string (“rgb(255,255,255)”)
Kind: static method of ColorUtils
Returns: string - rgb string (“rgba(255,255,255)”)
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toNumberARGB(color, format) ⇒ number
transform color to ARGB number (0xAARRGGBB)
Kind: static method of ColorUtils
Returns: number - rgba string (0xAARRGGBB)
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toNumberRGBA(color, format) ⇒ number
transform color to RGBA number (0xRRGGBBAA) ex: “rgba(255,255,255,1)” will return 4294967295
Kind: static method of ColorUtils
Returns: number - rgba string (0xRRGGBBAA)
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |
toNormalizedRGBA(color, format) ⇒ Object
Transform color to RGBA object holding normalized floating-point values from 0 to 1.
Kind: static method of ColorUtils
Returns: Object - rgba object compliant with KHRONOS notation
See: https://www.khronos.org/opengl/wiki/Image_Format#Color_formats
| Param | Type | Description |
|---|---|---|
| color | string | number | Object | color as string or number in rgba ("#RRGGBBAA" or "#RRGGBB" or "rgba(255, 255, 255, 1)" or "rgb(255, 255, 255)" or 0xFFFFFFFF) |
| format | number | color format bypass detection |