new $.oColorValue(colorValue)
openHarmony/openHarmony_color.js, line 72
This class holds a color value. It can be used to set color attributes to a specific value and to convert colors between different formats such as hex strings, RGBA decompositions, as well as HSL values.
Name | Type | Description |
---|---|---|
colorValue |
string/object | Hex string value, or object in form {rgba} |
Properties:
Name | Type | Description |
---|---|---|
r |
int | The int value of the red component. |
g |
int | The int value of the green component. |
b |
int | The int value of the blue component. |
a |
int | The int value of the alpha component. |
Example
// initialise the class to start setting up attributes and making conversions by creating a new instance
var myColor = new $.oColorValue("#336600ff");
$.log(myColor.r+" "+mycolor.g+" "+myColor.b+" "+myColor+a) // you can then access each component of the color
var myBackdrop = $.scn.root.addBackdrop("Backdrop")
var myBackdrop.color = myColor // can be used to set the color of a backdrop
Members
-
hfloat
-
Gets the color's HUE value.
-
lfloat
-
Gets the color's LIGHTNESS value.
-
sfloat
-
Gets the color's SATURATION value.
Methods
-
fromColorString(hexString)
openHarmony/openHarmony_color.js, line 146 -
Ingest a hex string in form #RRGGBBAA to define the colour.
Name Type Description hexString
string The colour in form #RRGGBBAA -
parseColorFromInt(colorInt)
openHarmony/openHarmony_color.js, line 164 -
Uses a color integer (used in backdrops) and parses the INT; applies the RGBA components of the INT to thos oColorValue
Name Type Description colorInt
int 24 bit-shifted integer containing RGBA values -
toHex()
openHarmony/openHarmony_color.js, line 138 -
The colour value represented as a string.
-
toInt()
openHarmony/openHarmony_color.js, line 112 -
Creates an int from the color value, as used for backdrop colors.
-
toString()
openHarmony/openHarmony_color.js, line 121 -
The colour value represented as a string.