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

# __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)

# getH()

Since
3.7.26

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)

# getHsl()

Since
3.7.26

Returns the color in hsl() syntax.

View source (opens new window)

Returns

string (opens new window)

# getHue()

Since
3.7.26

View source (opens new window)

Returns

integer (opens new window)

# getL()

Since
3.7.26

View source (opens new window)

Returns

integer (opens new window)

# getLightness()

Since
3.7.26

View source (opens new window)

Returns

integer (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)

# getS()

Since
3.7.26

View source (opens new window)

Returns

integer (opens new window)

# getSaturation()

Since
3.7.26

View source (opens new window)

Returns

integer (opens new window)

# serialize()

Returns the object’s serialized value.

View source (opens new window)

Returns

mixed – The serialized value