new Color(r, g, b [, a])
Creates a Color with the 4 specified channels. If alpha channel is omitted, 1 (opaque) is used. RGB Channels should be values between 0 & 255. Alpha Channel should a value between 0 (transparent) & 1 (opaque). If the values passed are outside these bounds, the closest upper or lower bound are used.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
r |
olympe.df.ONumber | number | The red channel value |
|
g |
olympe.df.ONumber | number | The green channel value |
|
b |
olympe.df.ONumber | number | The blues channel value |
|
a |
olympe.df.ONumber | number |
<optional> |
The alpha channel value (default: 1) |
Methods
-
<static> black()
-
Gets the color black.
Returns:
The color black
- Type
- olympe.df.Color
-
<static> blue()
-
Gets the color blue.
Returns:
The color blue
- Type
- olympe.df.Color
-
<static> create(r, g, b [, a])
-
Creates a
Color
with the 4 specified channel values. If alpha channel is omitted, 1 (opaque) is used. RGB Channels should be values between 0 & 255. Alpha Channel should a value between 0 (transparent) & 1 (opaque). If the values passed are outside these bounds, the closest upper or lower bound are used.Parameters:
Name Type Argument Default Description r
number | olympe.df.PONumber red channel value.
g
number | olympe.df.PONumber green channel value.
b
number | olympe.df.PONumber blue channel value.
a
number | olympe.df.PONumber <optional>
1 alpha channel value.
Returns:
The color.
- Type
- olympe.df.PColor
-
<static> darkCyan()
-
Gets the color dark cyan Validation color
Returns:
- Type
- olympe.df.Color
-
<static> darkGray()
-
Gets the color dark gray.
Returns:
The color dark gray
- Type
- olympe.df.Color
-
<static> darkSlategray()
-
Gets the color dark slate gray Default button background color
Returns:
the color dark slate gray
- Type
- olympe.df.Color
-
<static> fromHexString(str)
-
Constructs a new color from the specified hex string
Parameters:
Name Type Description str
olympe.df.POString | string | olympe.df.Node Returns:
- Type
- olympe.df.PColor
-
<static> fromJSON(json)
-
Deserializes an
Color
from a JSON object or string.Parameters:
Name Type Description json
string | Object Returns:
- Type
- olympe.df.Color
-
<static> fromProxies(r, g, b, a)
-
Constructs a new color from the specified rgba proxies
Parameters:
Name Type Description r
olympe.df.PONumber | number | olympe.df.Node g
olympe.df.PONumber | number | olympe.df.Node b
olympe.df.PONumber | number | olympe.df.Node a
olympe.df.PONumber | number | olympe.df.Node Returns:
- Type
- olympe.df.PColor
-
<static> getCachedColor(colorName, r, g, b [, a])
-
Gets a color from the color registry, creates it if necessary.
Parameters:
Name Type Argument Default Description colorName
string The name of the color (e.g. 'black')
r
number red channel value
g
number green channel value
b
number blue channel value
a
number <optional>
1 alpha channel value
Returns:
Cached color (creating it if needed)
- Type
- olympe.df.Color
-
<static> gray()
-
Gets the color gray.
Returns:
The color gray
- Type
- olympe.df.Color
-
<static> green()
-
Gets the color green.
Returns:
The color green
- Type
- olympe.df.Color
-
<static> lightGray()
-
Gets the color light gray.
Returns:
The color light gray
- Type
- olympe.df.Color
-
<static> lime()
-
Gets the color lime.
Returns:
The color lime
- Type
- olympe.df.Color
-
<static> magenta()
-
Gets the color magenta.
Returns:
The color magenta
- Type
- olympe.df.Color
-
<static> navy()
-
Gets the color navy blue.
Returns:
The color navy blue
- Type
- olympe.df.Color
-
<static> orange()
-
Gets the color orange.
Returns:
The color orange
- Type
- olympe.df.Color
-
<static> purple()
-
Gets the color purple.
Returns:
The color purple
- Type
- olympe.df.Color
-
<static> red()
-
Gets the color red.
Returns:
The color red
- Type
- olympe.df.Color
-
<static> transparent()
-
Gets the transparent color. The alpha channel is set to 0.
Returns:
The transparent color
- Type
- olympe.df.Color
-
<static> white()
-
Gets the color white.
Returns:
The color white
- Type
- olympe.df.Color
-
<static> yellow()
-
Gets the color yellow.
Returns:
The color yellow
- Type
- olympe.df.Color
-
blend(otherColor, blendRatio)
-
Creates a color that is the result of blending of this color with the specified color and ratio.
Parameters:
Name Type Description otherColor
olympe.df.Color blendRatio
olympe.df.PONumber | number 0..1
Returns:
- Type
- olympe.df.PColor
-
equals(obj)
-
Checks whether this Color is the same as another Object.
Parameters:
Name Type Description obj
* Object to be compared.
Returns:
true
if this Color andobj
are the same.- Type
- boolean
-
fade(alpha)
-
Creates a copy of this color but with the specified alpha
Parameters:
Name Type Description alpha
olympe.df.PONumber | number Returns:
- Type
- olympe.df.PColor
-
getAlpha()
-
Gets the alpha channel
Returns:
- Type
- olympe.df.PONumber
-
getBlue()
-
Gets the blue channel
Returns:
- Type
- olympe.df.PONumber
-
getGreen()
-
Gets the green channel
Returns:
- Type
- olympe.df.PONumber
-
getRed()
-
Gets the red channel
Returns:
- Type
- olympe.df.PONumber
-
toHexString()
-
Converts the color into an hexadecimal string.
Returns:
- Type
- olympe.df.Proxy.<string> | string
-
toJSON()
-
Converts this
Color
into a JSON string.Returns:
- Type
- string
-
toProxy()
-
Returns:
- Type
- olympe.df.Proxy.<olympe.df.Color>
-
toRGBString()
-
Converts the color into an rgb string.
Returns:
- Type
- !olympe.df.Proxy.<string> | string
-
toString()
-
Gets a string representation of the color.
Returns:
- Type
- string