ideal_text_color()
Choose the best text color (light or dark) for a background.
Usage
ideal_text_color(bg_color)Uses the APCA algorithm to determine whether white or black text provides better contrast against the given background.
Parameters
bg_color: str-
Background color as a hex string or CSS named color.
Returns
str-
Either
"#FFFFFF"(white) or"#000000"(black).
Examples
>>> ideal_text_color("#2c3e50")
'#FFFFFF'
>>> ideal_text_color("#e3f2fd")
'#000000'
>>> ideal_text_color("navy")
'#FFFFFF'