There’s a fantastic NPM package, simply called color, that handles all the different value types for you that would make this trivial. You could allow the user to choose their own sorting for instance. Of course disregard if you want to handle all the color logic on your own or not add another dependency.
Any color preview plugins that support `modern` rgb() css functions?
5 projects | reddit.com/r/neovim | 7 Aug 2022
Is there a way to do something similar to this in aseprite?
1 project | reddit.com/r/PixelArt | 6 Aug 2022
Show HN: Penumbra, a perceptually optimized color palette based on natural light
11 projects | news.ycombinator.com | 4 Aug 2022
1 project | news.ycombinator.com | 3 Aug 2022