You are here

public function Color::getGreen in Color API 8

Retrieve 'Green' value of the Color Field Color data object RGB property.

Return value

array The value for the RGB "red". An integer between 0 and 255.

Overrides ColorInterface::getGreen

File

src/Entity/Color.php, line 96

Class

Color
The Color API Color entity definition.

Namespace

Drupal\colorapi\Entity

Code

public function getGreen() {
  if ($color = $this
    ->get('color')) {
    return \Drupal::service('colorapi.service')
      ->hexToRgb($color, 'green');
  }
}