photonui.Color Class
Handle colors.
wEvents:
- value-changed:
- description: the selected color changed.
- callback: function(photonui.Color)
Constructor
photonui.Color
Parameters:
-
Object multiple
An object that can contain any property of the Color class (optional).
Item Index
Methods
- _bindEvent
- _callCallbacks
- _registerWEvents
- _unbindEvent
- _updateHSB
- _updateProperties deprecated
- _updateRGB
- destroy
- FormatToCssRgbaString static
- FormatToCssRgbString static
- FormatToRgbaHexString static
- FormatToRgbHexString static
- fromString
- getRGB
- getRGBA
- NormalizeRgbaColor static
- NormalizeRgbColor static
- ParseCssRgbaString static
- ParseCssRgbString static
- ParseNamedColor static
- ParseRgbaHexString static
- ParseRgbHexString static
- ParseString static
- registerCallback
- removeCallback
- setHSB
- setRGB
- setRGBA
Properties
- __callbacks
- __events
- alpha
- blue
- brightness
- cssRgbaString
- cssRgbString
- data
- green
- hexString deprecated
- hue
- NAMED_COLORS static
- red
- rgbaHexString
- rgbaString deprecated
- rgbHexString
- rgbString deprecated
- saturation
Methods
_bindEvent
-
id
-
element
-
evName
-
callback
-
[options]
Parameters:
_callCallbacks
-
wEvent
-
params
_updateHSB
()
private
Update HSB from RGB.
_updateProperties
-
properties
Parameters:
-
properties
ArrayThe properties to update.
_updateRGB
()
private
Update RGB from HSB.
destroy
()
FormatToCssRgbaString
-
red
-
green
-
blue
-
alpha
Format an RGBA color to CSS RGBA string (e.g. rgba(255, 0, 0, 1.00)
).
Parameters:
Returns:
The formatted color string.
FormatToCssRgbString
-
red
-
green
-
blue
Format an RGB color to CSS RGB string (e.g. rgb(255, 0, 0)
).
Parameters:
Returns:
The formatted color string.
FormatToRgbaHexString
-
red
-
green
-
blue
-
alpha
Format an RGBA color to hexadecimal RGBA string (e.g. #FF0000FF
).
Parameters:
Returns:
The formatted color string.
FormatToRgbHexString
-
red
-
green
-
blue
Format an RGB color to hexadecimal RGB string (e.g. #FF0000
).
Parameters:
Returns:
The formatted color string.
NormalizeRgbaColor
-
red
-
green
-
blue
-
alpha
Normalize an RGBA color.
Parameters:
Returns:
The normalized array [r, g, b, a]
where each component is an integer between 0-255.
NormalizeRgbColor
-
red
-
green
-
blue
Normalize an RGB color.
Parameters:
Returns:
The normalized array [r, g, b]
where each component is an integer between 0-255.
ParseCssRgbaString
-
color
Converts a CSS RGBA color (e.g. rgba(255, 0, 0, 0.3)
) to an [r, g, b, a]
array.
Parameters:
-
color
StringThe CSS RGBA color
Returns:
[r, g, b, a]
where each component is an integer between 0-255
ParseCssRgbString
-
color
Converts a CSS RGB color (e.g. rgb(255, 0, 0)
) to an [r, g, b]
array.
Parameters:
-
color
StringThe CSS RGB color
Returns:
[r, g, b]
where each component is an integer between 0-255
ParseNamedColor
-
color
Converts a named color (e.g. "red") to an [r, g, b]
array.
Parameters:
-
color
StringThe named color
Returns:
[r, g, b]
where each component is an integer between 0-255
ParseRgbaHexString
-
color
Converts an hexadecimal RGBA color (e.g. #FF0000FF
, #F00F
) to an [r, g, b, a]
array.
Parameters:
-
color
StringThe hexadecimal RGBA color
Returns:
[r, g, b, a]
where each component is an integer between 0-255
ParseRgbHexString
-
color
Converts an hexadecimal RGB color (e.g. #FF0000
, #F00
) to an [r, g, b]
array.
Parameters:
-
color
StringThe hexadecimal RGB color
Returns:
[r, g, b]
where each component is an integer between 0-255
ParseString
-
color
Converts any supported color format to an [r, g, b, a]
array.
Parameters:
-
color
String
Returns:
[r, g, b, a]
where each components is an integer between 0-255
registerCallback
-
id
-
wEvent
-
callback
-
thisArg
setHSB
-
hue
-
saturation
-
brightness
Set HSB color
The params can also be replaced by an array.
setRGB
-
red
-
green
-
blue
Set RGB(A) color (alias for setRGBA).
The params can also be replaced by an array.