public static double getHue(int color) {
		double var_R = ( color >> 16 & 0xff ) / 255.0;                   //RGB from 0 to 255
		double var_G = ( color >> 8 & 0xff ) / 255.0;
		double var_B = ( color & 0xff ) / 255.0;

		double var_Min = Math.min(Math.min( var_R, var_G), var_B );    //Min. value of RGB
		double var_Max = Math.max(Math.max( var_R, var_G), var_B );      //Max. value of RGB
		double del_Max = var_Max - var_Min;             //Delta RGB value

		if ( del_Max == 0 )                     //This is a gray, no chroma...
		{
			return 0.0;                               //HSL results from 0 to 1
		}
		else                                    //Chromatic data...
		{
			double del_R = ( ( ( var_Max - var_R ) / 6 ) + ( del_Max / 2 ) ) / del_Max;
			double del_G = ( ( ( var_Max - var_G ) / 6 ) + ( del_Max / 2 ) ) / del_Max;
			double del_B = ( ( ( var_Max - var_B ) / 6 ) + ( del_Max / 2 ) ) / del_Max;

			double H = 0.0f;
			if      ( var_R == var_Max ) H = del_B - del_G;
			else if ( var_G == var_Max ) H = ( 1 / 3.0 ) + del_R - del_B;
			else if ( var_B == var_Max ) H = ( 2 / 3.0 ) + del_G - del_R;

			if ( H < 0 ) H += 1;
			if ( H > 1 ) H -= 1;
			
			return H;
		}
	}