You are here

public function ColorData::setRgb in Color API 8

Set the 'rgb' property of the Color Data.

Parameters

array $rgb: An array containing the following values:

  • red: The value for the RGB "red". An integer between 0 and 255.
  • green: The value for the RGB "green". An integer between 0 and 255.
  • blue: The value for the RGB "blue". An integer between 0 and 255.

bool $notify: Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.

Overrides ColorInterface::setRgb

1 call to ColorData::setRgb()
ColorData::setValue in src/Plugin/DataType/ColorData.php
Overrides \Drupal\Core\TypedData\TypedData::setValue().

File

src/Plugin/DataType/ColorData.php, line 59

Class

ColorData
Provides the Color Typed Data type.

Namespace

Drupal\colorapi\Plugin\DataType

Code

public function setRgb(array $rgb, $notify = TRUE) {
  $this
    ->get('rgb')
    ->setValue($rgb, $notify);
}