def xkcdRGB2Lab(): xkcdRgb = readXkcdRGB() labColors = [] for (arr, name) in xkcdRgb: rgb = sRGBColor(arr[0], arr[1], arr[2], is_upscaled=True) lab = LabColor.get_value_tuple(convert_color(rgb, LabColor)) labColors.append((lab, name)) writeXkcdLab(labColors)
def _hex_to_lab_tuple(hex): rgb = sRGBColor.new_from_rgb_hex(hex) lab = convert_color(rgb, LabColor) return LabColor.get_value_tuple(lab)