How do I get a reference to the current swatches?
I'm a digital painter and comic book colorist, and I'm always on the lookout for ways to speed up my palette creation process. I already have a script that samples all the unique colors of a document and saves them to the swatches panel. What I want now is a way to sort the current swatches by either their H, S, or B values. Does anyone know how I could get an object reference to the current swatches?
To be clear, I know how I could sort an array of colors BEFORE saving them to the swatches panel. I'm looking for a way to take whatever is already in the swatches panel, and sort by hue, saturation, or brightness on the fly without having to save, parse, and reorder an ACO file or something.