Next / Previous / Contents

5.3. Colors

There are two general ways to specify colors in Tkinter.

  • You can use a string specifying the proportion of red, green, and blue in hexadecimal digits:

    #rgbFour bits per color
    #rrggbbEight bits per color
    #rrrgggbbbTwelve bits per color

    For example, '#fff' is white, '#000000' is black, '#000fff000' is pure green, and '#00ffff' is pure cyan (green plus blue).

  • You can also use any locally defined standard color name. The colors 'white', 'black', 'red', 'green', 'blue', 'cyan', 'yellow', and 'magenta' will always be available. Other names may work, depending on your local installation.