Retina 0.8.2, 7 bytes
A`p
d|e
Try it online! Link includes test cases. Assumes input in lower case. Outputs non-zero for rainbow colours, zero for the other inputs. Explanation: Simply checks that the colour contains the letters d
or e
but not p
.
64-byte version to check against the 21 specific cases of rainbow colours in three different capitalisations:
T`L`l`^[A-Z]+$|^.
^(red|orange|yellow|green|blue|indigo|violet)$
Try it online! Link includes test cases. Explanation: Either an uppercase input or the leading character is lowercased, after which the exact colours are matched.