def hex_to_rgb(value):
 value = value.lstrip('#')
 hex_total_length = len(value)
 rgb_section_length = (hex_total_length // 3)
 return tuple((int(value[i:(i + rgb_section_length)], 16) for i in range(0, hex_total_length, rgb_section_length)))

def hex_to_rgb ( value ) : value = value . lstrip ( '#' ) hex_total_length = len ( value ) rgb_section_length = ( hex_total_length // 3 ) return tuple ( ( int ( value [ i : ( i + rgb_section_length ) ] , 16 ) for i in range ( 0 , hex_total_length , rgb_section_length ) ) )
calculates rgb values from a hex color code .