def test_hex_to_rgb(self): # provided by http://en.labelpartners.com/pantone_coated_table.html matches = [[(254, 221, 0), "#FEDD00"], [(0, 20, 137), "#001489"], [(175, 152, 0), "#AF9800"], [(255, 127, 50), "#FF7F32"]] for rgb, hex_code in matches: self.assertSequenceEqual(hex_to_rgb(hex_code), list(map(lambda x: x / 255, rgb)))
def test_hex_to_rgb(self): # provided by http://en.labelpartners.com/pantone_coated_table.html matches = [[(254, 221, 0), "#FEDD00"], [(0, 20, 137), "#001489"], [(175, 152, 0), "#AF9800"], [(255, 127, 50), "#FF7F32"]] for rgb, hex_code in matches: self.assertSequenceEqual( hex_to_rgb(hex_code), list(map(lambda x: x / 255, rgb)))
def line_color(self): rgb_tuple = hex_to_rgb(self.current_gradient_color) max_index, _ = max(enumerate(rgb_tuple), key=operator.itemgetter(1)) return self.line_colors[max_index]
def line_color(self): rgb_tuple = hex_to_rgb(self.current_gradient_color) max_index, _ = max(enumerate(rgb_tuple), key=operator.itemgetter(1)) return self.line_colors[max_index]