Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert hex rgb to matplotlib color

hex_color = '3366CC'

# from 0-255 integer format
up_to_255_rgb = tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
#output: (51, 102, 204)

# from 0-1 float format
up_to_1_rgb = tuple(int(hex_color[i:i+2], 16)/255 for i in (0, 2, 4))
#output: (0.2, 0.4, 0.8)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #hex #rgb #matplotlib #color
ADD COMMENT
Topic
Name
8+7 =