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
Access
Read-only

View source (opens new window)

# blue

Type
integer (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# g

Type
integer (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# green

Type
integer (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# hex

Type
string (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# luma

Type
float (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# r

Type
integer (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# red

Type
integer (opens new window)
Default value
null
Access
Read-only

View source (opens new window)

# rgb

Type
string (opens new window)
Default value
null
Access
Read-only

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()
getHex() Returns the color as a hex.
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.
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

# __toString()

View source (opens new window)

Returns

string (opens new window)

# getB()

View source (opens new window)

Returns

integer (opens new window)

# getBlue()

View source (opens new window)

Returns

integer (opens new window)

# getG()

View source (opens new window)

Returns

integer (opens new window)

# getGreen()

View source (opens new window)

Returns

integer (opens new window)

# getHex()

Returns the color as a hex.

View source (opens new window)

Returns

string (opens new window)

# 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

float (opens new window)

# getR()

View source (opens new window)

Returns

integer (opens new window)

# getRed()

View source (opens new window)

Returns

integer (opens new window)

# getRgb()

Returns the color in rgb() syntax.

View source (opens new window)

Returns

string (opens new window)

# serialize()

Returns the object’s serialized value.

View source (opens new window)

Returns

mixed – The serialized value