You are here

public function ColorCMY::toRgb in Color Field 8.2

Get the color as a RGB instance.

Return value

\Drupal\color_field\ColorRGB The color as a RGB instance.

Overrides ColorInterface::toRgb

File

src/ColorCMY.php, line 103

Class

ColorCMY
ColorCMY represents the CMY color format.

Namespace

Drupal\color_field

Code

public function toRgb() {
  $red = (1 - $this->cyan) * 255;
  $green = (1 - $this->magenta) * 255;
  $blue = (1 - $this->yellow) * 255;
  return new ColorRGB($red, $green, $blue, $this
    ->getOpacity());
}