3

I d like to show rainbow colors in java, so the color first time: red, then light red.. then orange light orange, yellow...etc..

How i can do this?

lacas
  • 13,928
  • 30
  • 109
  • 183

2 Answers2

4

For rainbow colors I would suggets HSV (Hue-Saturation-Value) color space. For all rainbow colors just cycle through the hue.

kaoD
  • 1,534
  • 14
  • 25
  • yeah, i d like it:) any help on this? – lacas Jan 26 '11 at 14:12
  • Check out Color and ColorSpace classes. There's a default HSV ColorSpace defined, you just have to get its instance. – kaoD Jan 26 '11 at 14:19
  • 1
    Sadly that's not correct... The HSV model wraps around the original colour, and rainbows do not go back to red after violet (they continue with ultra-violet). – fortran Jan 28 '11 at 08:32
  • Good catch :) Technically that's true, but I guess he's fine with the visible spectrum. – kaoD Jan 28 '11 at 19:34
1

A few hints:

Community
  • 1
  • 1
fortran
  • 74,053
  • 25
  • 135
  • 175