📝 Edit page
➕ Add page
Hex color code
Convert integer to hex string
>>> hex(12525)
'0x30ed'
Remove prefix
>>> "{:x}".format(12525)
'30ed'
Left-pad with spaces
>>> "{:6x}".format(12525)
' 30ed'
Left-pad with zeroes
"{:06x}".format(12525)
'0030ed'
Use f-strings
>>> color_number = 12525
>>> f"{color_number:06x}"
'0030ed'
Hex to integer
>>> x = 0x30ed
>>> type(x)
<type 'int'>
Max for 6-digit hex code.
>> 0xffffff
16777215