‘Colors’ is a list of rgb tuples
Sort is a method available to list objects.
By default, python has a particular way of sorting tuples, so you’re overriding that by using ‘key’ argument that transforms the tuples into a different set of tuples. And then sorting the original list based on the ordering of the new list.
Lamda is used here as a throw away function. It’s a way of programming new simple functions in place rather than breaking your flow while you code and write a def function outside, then rewriting it inside of key.
You can probably use this code as is in Python Mode processing. I need to verify if colorsys module is available to be imported first.
Hope this clarifies it. Let me know if it’s still confusing.