c = color(255, 204, 0)
print(c)# Prints "-13312"
print(hex(c))# Prints "FFFFCC00"
print(hex(c, 6))# Prints "FFCC00"
Description Converts a color to a String containing the equivalent hexadecimal notation. For example, the color value produced by color(0, 102, 153) will convert to the String value "FF006699". This function can help make your geeky debugging sessions much happier.

Note that the maximum number of digits is 8, because an int value can only represent up to 32 bits. Specifying more than 8 digits will not increase the length of the string further.
Related unhex()

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.