mirror of
https://github.com/Intervention/image.git
synced 2025-08-31 17:41:58 +02:00
Normalize decoding of html color names to lower case
This commit is contained in:
@@ -146,8 +146,16 @@ trait CanReadHtmlColorNames
|
|||||||
'maroon' => '#800000',
|
'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
|
public function hexColorFromColorName(string $name): ?string
|
||||||
{
|
{
|
||||||
|
$name = strtolower($name);
|
||||||
if (!array_key_exists($name, $this->color_names)) {
|
if (!array_key_exists($name, $this->color_names)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user