Retrieve named colors (Hex) and convert to RGB

444
Vote up!

A simple helper I wrote so I could reference the same colours throughout my app more easily.

I have a color pallette for my app with named colours which I can refer to whenever I need to set the colour for something.

  • The get method returns a 3-value tuple containing the Red, Green and Blue values as decimals.
  • The getOver method returns a 4-value tuple containing the Red, Green, Blue and Alpha values as decimals. I've chosen a 75% transparency for all my colours which works well for my project.

Feel free to copy and modify this as needed.

Category: 
Contributor: 
moollaza