ColorData ​
- Type
- Class
- Namespace
- craft\fields\data
- Inherits
- craft\fields\data\ColorData » yii\base\BaseObject
- Implements
- craft\base\Serializable, yii\base\Configurable
- Since
- 3.0.0
Multi-select option field data class.
Public Properties ​
| Property | Description |
|---|---|
| b | integer |
| blue | integer |
| g | integer |
| green | integer |
| h | integer |
| hex | string |
| hsl | string |
| hue | integer |
| l | integer |
| lightness | integer |
| luma | float |
| r | integer |
| red | integer |
| rgb | string |
| s | integer |
| saturation | integer |
b ​
- Type
- integer
- Default value
null
blue ​
- Type
- integer
- Default value
null
g ​
- Type
- integer
- Default value
null
green ​
- Type
- integer
- Default value
null
h ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
hex ​
- Type
- string
- Default value
null
hsl ​
- Type
- string
- Default value
null- Access
- Read-only
- Since
- 3.7.26
hue ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
l ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
lightness ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
luma ​
- Type
- float
- Default value
null
r ​
- Type
- integer
- Default value
null
red ​
- Type
- integer
- Default value
null
rgb ​
- Type
- string
- Default value
null
s ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
saturation ​
- Type
- integer
- Default value
null- Access
- Read-only
- Since
- 3.7.26
Public Methods ​
| Method | Description |
|---|---|
| __call() | Calls the named method which is not a class method. |
| __construct() | Constructor. |
| __get() | Returns the value of an object property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __set() | Sets value of an object property. |
| __toString() | |
| __unset() | Sets an object property to null. |
| canGetProperty() | Returns a value indicating whether a property can be read. |
| canSetProperty() | Returns a value indicating whether a property can be set. |
| className() | 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() | Returns a value indicating whether a method is defined. |
| hasProperty() | Returns a value indicating whether a property is defined. |
| init() | Initializes the object. |
| serialize() | Returns the object’s serialized value. |
__construct() ​
Constructor.
Arguments ​
$hex(string) – Hex color value, beginning with#. (Shorthand is not supported, e.g.#f00.)$config(array) – Name-value pairs that will be used to initialize the object properties
__toString() ​
Returns ​
getB() ​
Returns ​
getBlue() ​
Returns ​
getG() ​
Returns ​
getGreen() ​
Returns ​
getH() ​
- Since
- 3.7.26
Returns ​
getHex() ​
Returns the color as a hex.
Returns ​
getHsl() ​
- Since
- 3.7.26
Returns the color in hsl() syntax.
Returns ​
getHue() ​
- Since
- 3.7.26
Returns ​
getL() ​
- Since
- 3.7.26
Returns ​
getLightness() ​
- Since
- 3.7.26
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
Returns ​
getR() ​
Returns ​
getRed() ​
Returns ​
getRgb() ​
Returns the color in rgb() syntax.
Returns ​
getS() ​
- Since
- 3.7.26
Returns ​
getSaturation() ​
- Since
- 3.7.26
Returns ​
serialize() ​
Returns the object’s serialized value.
Returns ​
mixed – The serialized value