Here you can find the source of interpolate(Color colour1, Color colour2, float colour2Fraction)
public static Color interpolate(Color colour1, Color colour2, float colour2Fraction)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { public static Color interpolate(Color colour1, Color colour2, float colour2Fraction) { float[] hsb1 = new float[3]; Color.RGBtoHSB(colour1.getRed(), colour1.getGreen(), colour1.getBlue(), hsb1); float[] hsb2 = new float[3]; Color.RGBtoHSB(colour2.getRed(), colour2.getGreen(), colour2.getBlue(), hsb2); float h = hsb1[0] + (float) colour2Fraction * (hsb2[0] - hsb1[0]); float s = hsb1[1] + (float) colour2Fraction * (hsb2[1] - hsb1[1]); float b = hsb1[2] + (float) colour2Fraction * (hsb2[2] - hsb1[2]); return Color.getHSBColor(h, s, b); }//from ww w . j av a 2 s. c o m }