Color
class Color (View source)
Performs color conversions.
Methods
static bool
validateHex($hex)
Validates whether a hexadecimal color value is syntactically correct.
static array
hexToRgb(string $hex)
Parses a hexadecimal color string like '#abc' or '#aabbcc'.
static string
rgbToHex(array|string $input)
Converts RGB color arrays and RGB strings in CSS notation to lowercase simple colors like '#aabbcc'.
static string
normalizeHexLength(string $hex)
Normalize the hex color length to 6 characters for comparison.
Details
static bool
validateHex($hex)
Validates whether a hexadecimal color value is syntactically correct.
static array
hexToRgb(string $hex)
Parses a hexadecimal color string like '#abc' or '#aabbcc'.
static string
rgbToHex(array|string $input)
Converts RGB color arrays and RGB strings in CSS notation to lowercase simple colors like '#aabbcc'.
static string
normalizeHexLength(string $hex)
Normalize the hex color length to 6 characters for comparison.