ColorData
- Type
- Class
- Namespace
- craft\fields\data
- Inherits
- craft\fields\data\ColorData » yii\base\BaseObject (opens new window)
- Implements
- craft\base\Serializable, yii\base\Configurable (opens new window)
- Since
- 3.0.0
Multi-select option field data class.
View source (opens new window)
# Public Properties
# b
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# blue
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# g
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# green
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# h
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# hex
- Type
- string (opens new window)
- Default value
null
View source (opens new window)
# hsl
- Type
- string (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# hue
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# l
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# lightness
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# luma
- Type
- float (opens new window)
- Default value
null
View source (opens new window)
# r
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# red
- Type
- integer (opens new window)
- Default value
null
View source (opens new window)
# rgb
- Type
- string (opens new window)
- Default value
null
View source (opens new window)
# s
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# saturation
- Type
- integer (opens new window)
- Default value
null
- Access
- Read-only
- Since
- 3.7.26
View source (opens new window)
# Public Methods
Method | Description |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__construct() | Constructor. |
__get() (opens new window) | Returns the value of an object property. |
__isset() (opens new window) | Checks if a property is set, i.e. defined and not null. |
__set() (opens new window) | Sets value of an object property. |
__toString() | |
__unset() (opens new window) | Sets an object property to null. |
canGetProperty() (opens new window) | Returns a value indicating whether a property can be read. |
canSetProperty() (opens new window) | Returns a value indicating whether a property can be set. |
className() (opens new window) | Returns the fully qualified name of this class. |
getB() | |
getBlue() | |
getG() | |
getGreen() | |
getH() | |
getHex() | Returns the color as a hex. |
getHsl() | Returns the color in hsl() syntax. |
getHue() | |
getL() | |
getLightness() | |
getLuma() | Get brightness of an image. Values closer to 0 are darker, closer to 1 are lighter. |
getR() | |
getRed() | |
getRgb() | Returns the color in rgb() syntax. |
getS() | |
getSaturation() | |
hasMethod() (opens new window) | Returns a value indicating whether a method is defined. |
hasProperty() (opens new window) | Returns a value indicating whether a property is defined. |
init() (opens new window) | Initializes the object. |
serialize() | Returns the object’s serialized value. |
# __construct()
Constructor.
View source (opens new window)
Arguments
$hex
(string (opens new window)) – Hex color value, beginning with#
. (Shorthand is not supported, e.g.#f00
.)$config
(array (opens new window)) – Name-value pairs that will be used to initialize the object properties
# __toString()
View source (opens new window)
Returns
# getB()
View source (opens new window)
Returns
# getBlue()
View source (opens new window)
Returns
# getG()
View source (opens new window)
Returns
# getGreen()
View source (opens new window)
Returns
# getH()
- Since
- 3.7.26
View source (opens new window)
Returns
# getHex()
Returns the color as a hex.
View source (opens new window)
Returns
# getHsl()
- Since
- 3.7.26
Returns the color in hsl()
syntax.
View source (opens new window)
Returns
# getHue()
- Since
- 3.7.26
View source (opens new window)
Returns
# getL()
- Since
- 3.7.26
View source (opens new window)
Returns
# getLightness()
- Since
- 3.7.26
View source (opens new window)
Returns
# getLuma()
Get brightness of an image. Values closer to 0 are darker, closer to 1 are lighter.
See also:
- http://stackoverflow.com/a/12228906/1136822 – Stack Overflow answer
- https://en.wikipedia.org/wiki/Luma_(video) – Luma
View source (opens new window)
Returns
# getR()
View source (opens new window)
Returns
# getRed()
View source (opens new window)
Returns
# getRgb()
Returns the color in rgb()
syntax.
View source (opens new window)
Returns
# getS()
- Since
- 3.7.26
View source (opens new window)
Returns
# getSaturation()
- Since
- 3.7.26
View source (opens new window)
Returns
# serialize()
Returns the object’s serialized value.
View source (opens new window)
Returns
mixed
– The serialized value