public function ColorRGB::toString in Color Field 8.2
A string representation of this color in the current format.
Parameters
bool $opacity: Whether or not to display the opacity.
Return value
string The color in format: #RRGGBB
Overrides ColorInterface::toString
File
- src/
ColorRGB.php, line 102
Class
- ColorRGB
- RGB represents the RGB color format.
Namespace
Drupal\color_fieldCode
public function toString($opacity = TRUE) {
if ($opacity) {
$output = 'rgba(' . $this
->getRed() . ',' . $this
->getGreen() . ',' . $this
->getBlue() . ',' . $this
->getOpacity() . ')';
}
else {
$output = 'rgb(' . $this
->getRed() . ',' . $this
->getGreen() . ',' . $this
->getBlue() . ')';
}
return strtolower($output);
}