@@ -10,24 +10,27 @@ public class ColorUtils {
1010
1111 public static Color rainbow () {
1212 long offset = 999999999999L ;
13- float hue = (float ) (System .nanoTime () + offset ) / 1.0E10f % 1.0f ;
14- return new Color ((int ) Long .parseLong (Integer .toHexString (Color .HSBtoRGB (hue , 1.0f , 1.0f )), 16 ));
13+ float hue = Math .abs ((float ) (System .nanoTime () + offset ) / 1.0E10f % 1.0f );
14+ int color = Color .HSBtoRGB (hue , 1.0f , 1.0f );
15+ return new Color (color );
1516 }
1617
1718 public static Color wave (double wave , double satur , double bright ) {
18- float hue = ( float ) (System .nanoTime ()) / 1.0E10f % 1.0f ;
19+ float hue = Math . abs (( float ) (System .nanoTime ()) / 1.0E10f % 1.0f ) ;
1920 hue = (float ) (hue + (wave / 10 ));
2021 int color = Color .HSBtoRGB (hue , (float ) satur , (float ) bright );
2122 return new Color (color );
2223 }
2324
25+
2426 public static Color randomColor (boolean nice ) {
2527 if (nice )
26- return Color .getHSBColor (new Random ().nextFloat (), (float ) ThreadLocalRandom .current ().nextDouble (0.6 , 0.8 ), 0.9f );
28+ return Color .getHSBColor (new Random ().nextFloat (), (float ) ThreadLocalRandom .current ().nextDouble (0.5 , 0.7 ), ( float ) ThreadLocalRandom . current (). nextDouble ( 0.6 , 0.8 ) );
2729 else
2830 return new Color ((int ) (Math .random () * 0x1000000 ));
2931 }
3032
33+
3134 public static void glColor (int color ) {
3235 GlStateManager .color ((float ) (color >> 16 & 255 ) / 255F , (float ) (color >> 8 & 255 ) / 255F , (float ) (color & 255 ) / 255F , (float ) (color >> 24 & 255 ) / 255F );
3336 }
@@ -43,9 +46,10 @@ static public float colorcalc(int c, int location) {
4346 public static int rainbow (double saturation , double brightness , double alpha ) {
4447 long offset = 999999999999L ;
4548 float fade = 1.0f ;
46- float hue2 = ( float ) (System .nanoTime () + offset ) / 1.0E10f % 1.0f ;
47- long color = Long . parseLong ( Integer . toHexString ( Color .HSBtoRGB (hue2 , (float ) saturation , (float ) brightness )), 16 );
48- Color c = new Color (( int ) color );
49+ float hue2 = Math . abs (( float ) (System .nanoTime () + offset ) / 1.0E10f % 1.0f ) ;
50+ int rgbColor = Color .HSBtoRGB (hue2 , (float ) saturation , (float ) brightness );
51+ Color c = new Color (rgbColor );
4952 return new Color ((float ) c .getRed () / 255.0f * fade , (float ) c .getGreen () / 255.0f * fade , (float ) c .getBlue () / 255.0f * fade , (float ) alpha ).getRGB ();
5053 }
54+
5155}
0 commit comments