Beispiel #1
0
  public static int getLabelForegroundColorBasedOnBackgroundColor(int colorRgb) {
    float[] hsl = {0.f, 0.f, 0.f};
    rgbToHsl(colorRgb, hsl);

    if (hsl[2] > 0.5f) hsl[2] -= 0.44f;
    else hsl[2] += 0.44f;

    return hslToRgb(hsl);
  }