'How to create a new color with tkinter

So I'm trying to make new color called rainbow so that I can make multi-colored fireworks. This is my code

colors=["red","green","blue","yellow","white","orange","purple"]
class Explosion:
        def __init__(self,canvas,radius=80,color="rainbow",l=15,d=[],active=False):
                self.canvas=canvas
                self.radius=radius
                if color=="rainbow":
                        self.color=random.choice(colors)
                else:
                        self.color=color
                self.l=l
                self.d=d
                self.__active=active

Also, if the color is not rainbow I want it to just be that color. "rainbow" is not recognized as a color, but I'm not sure how to get it to work. This code is simplified because this is the only part that's not working.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source