/** * @expectedException InvalidArgumentException * @expectedExceptionMessage Hexadecimal color is not supported */ public function testStaticMethodFromHexWithWrongParams() { $color = Color::fromHex('#ddd'); }
<?php require_once __DIR__ . '/../vendor/autoload.php'; use PhpColor\Color; // the web safe colors $colors = []; for ($r = 0; $r <= 17; $r += 3) { for ($g = 0; $g <= 17; $g += 3) { for ($b = 0; $b <= 17; $b += 3) { $array = [dechex($r), dechex($r), dechex($g), dechex($g), dechex($b), dechex($b)]; $string = join('', $array); $color = Color::fromHex($string); if (!in_array($color, $colors)) { array_push($colors, $color); } } } } $count = count($colors); ?> <!doctype html> <html> <head> <style type="text/css"> .color { color:#fff; width:150px; height:150px; line-height: 150px; display: inline-block; text-align: center;