Color (@NotNull Color foreground, @NotNull Color background) { int backgroundAlpha = background.getAlpha(); int r = worstContrastComponent(foreground.getRed(), background.getRed(), backgroundAlpha); int g = worstContrastComponent(foreground.getGreen(), background.getGreen(), backgroundAlpha); int b = worstContrastComponent(foreground.getBlue(), background.getBlue(), backgroundAlpha); return new Color(r, g, b); }