readableOn function

PosColor readableOn(
  1. PosColor background, {
  2. PosColor light = const PosColor(0xFF, 0xFF, 0xFF),
  3. PosColor dark = const PosColor(0x0F, 0x17, 0x2A),
})

Die besser lesbare von zwei Farben auf background.

Implementation

PosColor readableOn(PosColor background, {PosColor light = const PosColor(0xFF, 0xFF, 0xFF), PosColor dark = const PosColor(0x0F, 0x17, 0x2A)}) {
  return contrastRatio(light, background) >= contrastRatio(dark, background) ? light : dark;
}