Same name in other branches
  1. 8.x-2.x src/ColorHex.php \Drupal\color_field\ColorHex::toRgb()

Overrides ColorInterface::toRgb

1 call to ColorHex::toRgb()
ColorHex::toString in src/ColorHex.php
A string representation of this color in the current format.

File

src/ColorHex.php, line 85

Class

ColorHex
Hex represents the Hex color format.

Namespace

Drupal\color_field

Code

public function toRgb() : ColorRGB {
    $red = ($this->color & 0xff0000) >> 16;
    $green = ($this->color & 0xff00) >> 8;
    $blue = $this->color & 0xff;
    $opacity = $this->getOpacity();
    return new ColorRGB($red, $green, $blue, $opacity);
}