Color (@NotNull Color c1, final Color c2, final double factor) { assert 0 <= factor && factor <= 1.0 : factor; final double backFactor = 1.0 - factor; //noinspection UseJBColor return new Color( Math.min((int)Math.round(c1.getRed() * backFactor + c2.getRed() * factor), 255), Math.min((int)Math.round(c1.getGreen() * backFactor + c2.getGreen() * factor), 255), Math.min((int)Math.round(c1.getBlue() * backFactor + c2.getBlue() * factor), 255) ); }