[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Is there some type of hex codes to rgb converter or something?



Oh nice, thanks for the alternative But how do u know if ur gonna get a red/blue...etc.. out the colors, kinda confusing.

On 9/11/07, Peter Shinners < pete@xxxxxxxxxxxx> wrote:
Lamonte Harris wrote:
> I like using HTML hex, is there a library or something on pygame or
> python it self to convert hex to rgb

Pygame comes with a color module. Just noticed it wasn't in the docs though.


import pygame.color

red = pygame.color.Color("#ff0000")
blue = pygame.color.Color("cornflowerblue")

It also includes some simple math, so you can mix colors yourself.

purple = pygame.color.add (red, blue)