Given a background color, how to get a foreground color that makes it readable on that background color?
I mean computing that foreground color automatically in a pr
In case this could still be useful for someone, this is the Dart implementation based on the answers above
Color getInverseBW(Color color) { double luminance = (0.2126 * color.red + 0.7152 * color.green + 0.0722 * color.blue); return (luminance < 140) ? Color(0xffffffff) : Color(0xff000000); }