Setting Color Values (Python)

Color values are expressed as integers. If you're accustomed to specifying colors in RGB format, you can convert to the associated integer using the following:

integer color value = R + G*(256) + B*(256^2)

where R, G, and B are the RGB values. For reference, following are some of the most common colors and their integer values:

Table 1. Color codes
Color Integer Value
Black 0
Blue 16711680
Cyan 16776960
Green 65280
Magenta 16711935
Red 255
White 16777215
Yellow 65535