color-sorter
Sort CSS colors by hue, then by saturation. Black-grey-white colors (colors with 0% saturation) are shifted to the end.
This sorting algorithm is very opinionated and might not fit your needs!
Usage
const sortColors = require('color-sorter');
const colors = [
{ value: '#000' },
{ value: 'red' },
{ value: 'hsl(0, 10%, 60%)' }
];
const sorted = sortColors(colors);
Examples
These examples can be seen on Project Wallace where this package is used for sorting the colors.
CSS-Tricks
Smashing Magazine
Bootstrap
Foundation
Project Wallace