1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-30 09:10:21 +02:00

Normalize decoding of html color names to lower case

This commit is contained in:
Oliver Vogel
2022-07-09 16:19:33 +02:00
parent 347942f14c
commit e457f3aeb1

View File

@@ -146,8 +146,16 @@ trait CanReadHtmlColorNames
'maroon' => '#800000',
];
/**
* Transform given html color name to hex color
* or return null, if color name doesn't exist.
*
* @param string $name
* @return null|string
*/
public function hexColorFromColorName(string $name): ?string
{
$name = strtolower($name);
if (!array_key_exists($name, $this->color_names)) {
return null;
}