useWhiteForeground function

bool useWhiteForeground(
  1. Color backgroundColor
)

Help you choosing the black or white foreground color to improve the foreground visible.

Implementation

bool useWhiteForeground(Color backgroundColor) =>
    1.05 / (backgroundColor.computeLuminance() + 0.05) > 4.5;