20
2
Challenge
Consider the rainbow as seven colours, represented by strings as Red Orange Yellow Green Blue Indigo Violet
.
Your task is to create a program that receives one of these colours as input and outputs next in order rainbow colour. This includes overlapping Violet -> Red
Input
A string containing one of rainbow colours.
Output
The next in order colour of the rainbow.
Rules
- Colour names are case sensitive. They must match the case included in this post.
- The input will always be valid. Any behavior is allowed for invalid input.
- This is code golf, so the shortest amount of bytes wins!
Example Input and Output
Input -> Output
Red -> Orange
Orange -> Yellow
Yellow -> Green
Green -> Blue
Blue -> Indigo
Indigo -> Violet
Violet -> Red
1"Provide at least one example input and output. Make sure they match your own description of what the input should look like." Are you describing your own challenge post? Or is this a requirement for solutions? – recursive – 2018-03-21T06:52:58.450
Do the test cases give the exact set of possible inputs? Do we have to use the same capitalization? – xnor – 2018-03-21T07:28:27.597
6Are lower case colours okay? – Emigna – 2018-03-21T08:32:31.767
4But what happens when you reach 'gray'? ;) – AJFaraday – 2018-03-21T11:24:46.427
1@Emigna From the way OP phrased the question, I would guess that you can choose whether to do upper case, lower case, or case insensitive.
Provide at least one example input and output. Make sure they match your own description of what the input should look like.
– sonrad10 – 2018-03-21T13:47:03.607@Enigma lower case colours are not okay – lolad – 2018-03-21T19:51:23.730
1Are trailing spaces okay? – ivzem – 2018-03-22T17:45:00.290
1The issue I have with wrapping back to the first color is that double rainbows reverse direction rather than starting over. – Broots Waymb – 2018-03-22T18:46:43.797