'Rainbow color function
Is there a python library with a rainbow color function?
What I want is a function such that I give as input a number between 0. and 1. and it returns a color on the rainbow palette between red and violet. In this way, if the input is
np.linspace(0.,1.,7) it will return the seven colors of the rainbow in order.
Solution 1:[1]
Use pystyle
import pystyle
from pystyle import Colors, Colorate
print(Colorate.Horizontal(Colors.rainbow, 'some rainbow text'))
Solution 2:[2]
https://gist.github.com/kawanet/a880c83f06d6baf742e45ac9ac52af96
You can easily create a function that returns the value what you needed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Regenxy X |
| Solution 2 | lucas rshane |
