I have a list of tuple that looks like the following:
[(image, rgb tuple, float), (image, rgb tuple, float) ...]
I want to sort this list by the rgb value. I am given a "target" color and have to sort the list by how close each rgb tuple is to the target color. I have a function called color_distance(c1, c2)
that takes in two colors and returns the distance between them. I want to use this color distance function as a comparator function to sort my list of tuples by each tuple's rgb value distance to the target color.
I could sort the list by selection sort and use my color_distance function to compare but I want it sorted faster/ using a library function.
I am trying to use the sorted()
function in python but don't know how.