You are here

protected function Kint_Parsers_Color::_parse in Devel 8.2

Same name and namespace in other branches
  1. 8 kint/kint/parsers/custom/color.php \Kint_Parsers_Color::_parse()

* main and usually single method a custom parser must implement * *

Parameters

mixed $variable: * * @return mixed [!!!] false is returned if the variable is not of current type

Overrides kintParser::_parse

File

kint/kint/parsers/custom/color.php, line 41

Class

Kint_Parsers_Color

Code

protected function _parse(&$variable) {
  if (!self::_fits($variable)) {
    return false;
  }
  $this->type = 'CSS color';
  $variants = self::_convert($variable);
  $this->value = "<div style=\"background:{$variable}\" class=\"kint-color-preview\">{$variable}</div>" . "<strong>hex :</strong> {$variants['hex']}\n" . "<strong>rgb :</strong> {$variants['rgb']}\n" . (isset($variants['name']) ? "<strong>name:</strong> {$variants['name']}\n" : '') . "<strong>hsl :</strong> {$variants['hsl']}";
}