Same name and namespace in other branches
  1. 3.0.x src/ColorHSL.php \Drupal\color_field\ColorHSL::toString() 1 commentaire

A string representation of this color in the current format.

Paramètres

bool $opacity: Whether or not to display the opacity.

Return value

string The color in format: #RRGGBB

Overrides ColorInterface::toString

Fichier

src/ColorHSL.php, line 102

Classe

ColorHSL
RGB represents the RGB color format.

Namespace

Drupal\color_field

Code

public function toString($opacity = TRUE) {
    if ($opacity) {
        $output = 'hsla(' . $this->hue . ',' . $this->sat . ',' . $this->lum . ',' . $this->getOpacity() . ')';
    }
    else {
        $output = 'hsl(' . $this->hue . ',' . $this->sat . ',' . $this->lum . ')';
    }
    return strtolower($output);
}