Craft 3 Class Reference

Class craft\fields\data\ColorData

Inheritance
craft\fields\data\ColorData » yii\base\BaseObject
Implements
craft\base\Serializable, yii\base\Configurable
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/fields/data/ColorData.php

Multi-select option field data class.

Public Methods
Method Description Defined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__construct() Constructor. craft\fields\data\ColorData
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__toString() craft\fields\data\ColorData
__unset() Sets an object property to null. yii\base\BaseObject
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
getB() craft\fields\data\ColorData
getBlue() craft\fields\data\ColorData
getG() craft\fields\data\ColorData
getGreen() craft\fields\data\ColorData
getHex() Returns the color as a hex. craft\fields\data\ColorData
getLuma() Get brightness of an image. Values closer to 0 are darker, closer to 1 are lighter. craft\fields\data\ColorData
getR() craft\fields\data\ColorData
getRed() craft\fields\data\ColorData
getRgb() Returns the color in rgb() syntax. craft\fields\data\ColorData
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
init() Initializes the object. yii\base\BaseObject
serialize() Returns the object’s serialized value. craft\fields\data\ColorData

Method Details

__construct() public method #

Constructor.

public void __construct ( \craft\fields\data\string $hex, array $config = [] )
$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() public method #

public string __toString ( )

getB() public method #

public integer getB ( )

getBlue() public method #

public integer getBlue ( )

getG() public method #

public integer getG ( )

getGreen() public method #

public integer getGreen ( )

getHex() public method #

Returns the color as a hex.

public string getHex ( )

getLuma() public method #

Get brightness of an image. Values closer to 0 are darker, closer to 1 are lighter.

See also:

public float getLuma ( )

getR() public method #

public integer getR ( )

getRed() public method #

public integer getRed ( )

getRgb() public method #

Returns the color in rgb() syntax.

public string getRgb ( )

serialize() public method #

Returns the object’s serialized value.

public mixed serialize ( )
return mixed The serialized value