Exemple #1
0
 public static function getHtml(ColorInterface $color, $width = null, $height = null)
 {
     $width = $width ?: 120;
     $height = $height ?: 120;
     $color = $color->getRgba();
     $inversed = self::inverse($color)->getRgba();
     $name = self::getName($color);
     $hue = $color->getHsl()->getHue();
     return sprintf('<div style="display: inline-block; vertical-align: middle; width: %dpx; height: %dpx; ' . 'background: %s; color: %s; font-size: 12px; font-family: Arial, sans-serif; ' . 'text-align: center; line-height: %dpx;">%s<br>%s<br>%s%s</div>', $width, $height, $color, $inversed, intval($height / 4), $color->getLab()->getRgb(), Color::getHexString($color->getRgb()), self::getHueRange($hue) . "->" . round($hue, 2), $name ? "<br>{$name}" : '');
 }
Exemple #2
0
function color_get_hex_string($color, $expand = false)
{
    return Color::getHexString(color_get($color), $expand);
}