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

Overrides ColorInterface::toRgb

1 method overrides ColorCMY::toRgb()
ColorCMYK::toRgb in src/ColorCMYK.php
Get the color as an RGB instance.

File

src/ColorCMY.php, line 105

Class

ColorCMY
ColorCMY represents the CMY color format.

Namespace

Drupal\color_field

Code

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