0

What I need to do is an application that when you click on the screen it will just show random colours on the screen; press the screen again and you will get other random colours (colours that are not only Red, Blue, Green).

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Levan
  • 103
  • 3

1 Answers1

2

If you need only bright, saturated colors, use Color.HSVToColor() instead of setting R, G and B components directrly:

float[] hsvColor = {0, 1, 1};
// randomly generate only hue component,
// leaving saturation and brightness maximum possible
hsvColor[0] = new Random().nextFloat() * 360;
view.setBackgroundColor(Color.HSVToColor(hsvColor));
Alex Salauyou
  • 14,185
  • 5
  • 45
  • 67