public static Color rotateHue ( Color color , float fraction ) { float [ ] af = Color . RGBtoHSB ( color . getRed ( ) , color . getGreen ( ) , color . getBlue ( ) , null ) ; float hue = af [ 0 ] ; float saturation = af [ 1 ] ; float brightness = af [ 2 ] ; float hueNew = hue + fraction ; Color hsb = Color . getHSBColor ( hueNew , saturation , brightness ) ; return new Color ( hsb . getRed ( ) , hsb . getGreen ( ) , hsb . getBlue ( ) , color . getAlpha ( ) ) ; }
Rotate a color through HSB space