private static int worstContrastComponent(int foregroundComponent, int backgroundComponent, int backgroundAlpha) {
    if (backgroundAlpha == 255) {
      // Irrelevant since background is completely opaque in this case
      return 0;
    }
    int component = (255 * foregroundComponent - backgroundAlpha * backgroundComponent) / (255 - backgroundAlpha);

    return Math.max(0, Math.min(component, 255));
  }
private static int worstContrastComponent(int foregroundComponent, int backgroundComponent, int backgroundAlpha)