protected Color desaturate(Color color){
  float[] tmp=Color.RGBtoHSB(color.getRed(),color.getGreen(),color.getBlue(),null);
  tmp[1]/=3.0f;
  tmp[2]=clamp(1.0f - (1.0f - tmp[2]) / 3f);
  return new Color((Color.HSBtoRGB(tmp[0],tmp[1],tmp[2]) & 0xFFFFFF));
}

protected Color desaturate ( Color color ) { float [ ] tmp = Color . RGBtoHSB ( color . getRed ( ) , color . getGreen ( ) , color . getBlue ( ) , null ) ; tmp [ 1 ] /= 3.0f ; tmp [ 2 ] = clamp ( 1.0f - ( 1.0f - tmp [ 2 ] ) / 3f ) ; return new Color ( ( Color . HSBtoRGB ( tmp [ 0 ] , tmp [ 1 ] , tmp [ 2 ] ) & 0xFFFFFF ) ) ; }
returns a new color with the saturation cut to one third the original , and the brightness moved one third closer to white .
