Same name and namespace in other branches
- 3.0.x src/ColorRGB.php \Drupal\color_field\ColorRGB::toHex()
Get the color as a hex instance.
Return value
\Drupal\color_field\ColorHex The color as a hex instance.
Overrides ColorInterface::toHex
File
-
src/
ColorRGB.php, line 115
Class
- ColorRGB
- RGB represents the RGB color format.
Namespace
Drupal\color_fieldCode
public function toHex() {
return new ColorHex($this->getRed() << 16 | $this->getGreen() << 8 | $this->getBlue(), $this->getOpacity());
}