Color
Functions to create and manipulate colors.
Functions
Creates a color from a HEY part.
Color.fromHEX("#FFF")
Color.fromHEX("#FFFFFF")
Color.fromHEX("#FFFFFFFF")
Creates a color from hue, saturation, value and alpha parts.
Color.fromHSVA(0, 100, 100, 100)
Creates a color from red, green, blue and alpha parts.
Color.fromRGBA(255, 255, 255, 100)
Returns the brightness of the given color base on the W3C formula
Color.getBrightness(Color.fromRGBA(255,255,255,100)) == 1000
Color.getBrightness(Color.fromRGBA(0,0,0,100)) == 0
Returns the readable text color (white or black) based on the brightness of the color.
color =
Color.fromRGBA(255, 255, 255, 100)
Color.readableTextColor(color) == Color.fromRGBA(0, 0, 0, 100)
Sets the saturation to the given value of the given color.
color =
Color.fromHSVA(0, 100, 100, 100)
Color.setSaturation(50, color) == Color.fromHSVA(0, 50, 100, 100)
Sets the value to the given value of the given color.
color =
Color.fromHSVA(0, 100, 100, 100)
Color.setValue(50, color) == Color.fromHSVA(0, 100, 50, 100)
Converts the given color to the CSS RGBA represenation.
color =
Color.fromRGBA(255, 255, 255, 100)
Color.toCSSRGBA(color) == "rgba(255,255,255,1)"
Converts the internal represenation of the color to HEX.
color =
Color.fromHSVA(0, 100, 100, 100)
Color.toHEX(color) == Color.fromHEX("#FFFFFFFF")
Converts the internal represenation of the color to HSVA.
color =
Color.fromRGBA(255, 255, 255, 100)
Color.toHSVA(color) == Color.fromHSVA(0, 100, 100, 100)
Converts the internal represenation of the color to RGBA.
color =
Color.fromHSVA(0, 100, 100, 100)
Color.toRGBA(color) == Color.fromRGBA(255, 255, 255, 100)