ColorUtils

ColorUtils ⇐ Class

Kind: global class
Extends: Class

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")

ParamTypeDescription
colorstring | 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)

formatnumber

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")

ParamTypeDescription
colorstring | 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)

formatnumber

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")

ParamTypeDescription
colorstring | 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)

formatnumber

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)”)

ParamTypeDescription
colorstring | 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)

formatnumber

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)”)

ParamTypeDescription
colorstring | 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)

formatnumber

color format bypass detection

toNumberARGB(color, format) ⇒ number

transform color to ARGB number (0xAARRGGBB)

Kind: static method of ColorUtils
Returns: number - rgba string (0xAARRGGBB)

ParamTypeDescription
colorstring | 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)

formatnumber

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)

ParamTypeDescription
colorstring | 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)

formatnumber

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

ParamTypeDescription
colorstring | 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)

formatnumber

color format bypass detection