Same name in other branches
- 8.x-2.x src/ColorRGB.php \Drupal\color_field\ColorRGB::__construct()
Create a new RGB color.
Parameters
int $red: The red (0-255)
int $green: The green (0-255)
int $blue: The blue (0-255)
float $opacity: The opacity.
File
-
src/
ColorRGB.php, line 45
Class
- ColorRGB
- RGB represents the RGB color format.
Namespace
Drupal\color_fieldCode
public function __construct(int $red, int $green, int $blue, float $opacity) {
$this->red = max(0, min(255, $red));
$this->green = max(0, min(255, $green));
$this->blue = max(0, min(255, $blue));
$this->opacity = $opacity;
}