Sort Colors

john's Avatar

john

Jan 21, 2025 @ 02:00 AM

A simple yet handy node: sort_colors.

Sort_colors takes a list of colors and sorts them in one of four different ways: luma, hue, saturation, and brightness.

It takes three parameters:

  • Colors. A list of colors
  • Sort by. The property by which you want to sort the colors
  • Reverse sort. If checked will reverse the sort order

Sort_colors is particularly handy when you are stepping through different possible palettes and want to see what the lighter colors look like against the darker colors. Luma is the most useful sort for this task.

The attached demo applies a quartet of colors, chosen from the sanzo_colors node, to a yin yang symbol. The luma sort finds the darkest and lightest colors for the yin and yang, and good contrasting colors for each eye. The demo shows a simple spectrum (extended to seven colors to see intermediate shades) for each of the four possible sorts.

It is fun to step through different yin yang color combinations by changing the quartet number in the sanzo_colors node.

Enjoy!

Reply to this discussion

Internal reply

        No formatting (switch to Markdown)

        Already uploaded files

        • sort_colors_screenshot.png 528 KB
        • sort_colors_demo.ndbx.zip 559 KB

          You can attach files up to 10MB

          If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

            Keyboard shortcuts

            Generic

            ? Show this help
            ESC Blurs the current field

            Comment Form

            r Focus the comment reply box
            ^ + ↩ Submit the comment

            You can use Command ⌘ instead of Control ^ on Mac

            Recent Discussions

            09 May 08:27
            07 May 03:57
            06 May 06:46
            06 May 02:15
            21 Apr 10:47

             

            21 Apr 10:41
            21 Apr 05:56
            19 Apr 19:17
            18 Apr 00:04
            14 Apr 22:18
            13 Apr 23:09