A 3 or 6 character hexadecimal color code. The leading # is optional.
Defaults to #008000 (green) if not provided.
The contrasting color as a 6-character hex string with leading #.
Returns #000000 (black) for light backgrounds or #ffffff (white) for dark backgrounds.
Determines the optimal contrast color (black or white) for text displayed on a given background color.
Uses the YIQ color space formula to calculate perceived brightness and returns either black (
#000000) or white (#ffffff) for maximum readability.