transformToLightColor static method

Color transformToLightColor(
  1. Color color
)

Implementation

static Color transformToLightColor(Color color) {
  // Round to nearest: round((v + 255) / 2) == (v + 256) >> 1
  int mixToWhite(int v) => ((v + 256) >> 1);
  final int r = mixToWhite(_colorByte(color.r));
  final int g = mixToWhite(_colorByte(color.g));
  final int b = mixToWhite(_colorByte(color.b));
  final int a = _colorByte(color.a);
  return Color.fromARGB(a, r, g, b);
}