Luma Colors Node

john's Avatar


05 Jan, 2024 04:54 PM

Another addition to the color theory wing of the Cartan Node Library: Luma_colors.

Luma_colors is a new way of generating random colors. In contrast to my Colors node, which generates colors between a pair of start and end colors, luma_colors allows you to create colors with a specific luma value. For more about luma see:

In other words, it lets you pick a bunch of bright colors, or a bunch of dark colors - where bight and dark are based on the actual perceived brightness. Luma_colors takes five inputs:

  • Amount. Then number of colors you want
  • Luma percent. The desired luma value as a percentage from 0 to 100%
  • Plus or minus. The range of acceptable luma values. For example, if you set luma to 47% and the range to 5%, your random colors will be guaranteed to have luma values between 42% and 52%.
  • Seed. The random seed. Change to see a different selection of colors matching your criteria.
  • Sort by hue. If checked, the random colors will be sorted by hue.

It is easy to calculate a luma value for a color. Doing the reverse, generating a variety of colors that have a particular luma value - and doing so in a balanced way that does not favor one shade over another - is harder. Now that I finally got it working, I find this node is a joy to use.

Set amount to a few hundred colors and just drag the luma value up and down to see what happens. Once you get the brightness you want, increase the range to add more variety. Drag the seed to make the colors sparkle. Sort by hue to turn the wild checkerboard of colors into a smoother gradient. You can quickly get some nice results.

Luma_colors also makes it easy to do something that would otherwise be hard: create contrasting regions of variegated color. I show a nice example of this in the attached demo (see screenshot).

I construct a yin-yang symbol filled with pixelated colors - dark colors for the yin, bright colors for the yang. I provide a separate luma_colors control for each of the four regions: the two main spirals and the two eyes. You can try adjusting the controls for any one of these regions to see what happens.

Incidentally, to make this example I also created a pixelize node that turns any shape into an array of blocks (with curved blocks at the edges to follow the shape). You can change the block size (but don't make it too small - it might take a million tiny blocks to fill a large shape and that would make Nodebox very tired.). I didn't intend to release pixelize as a separate node in my library, but maybe I should. If anyone sees this and asks me to, I will consider it!

I look forward to seeing what you all will do with this!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • luma_colors_screenshot.png 676 KB
  • 32.8 KB

Attached Files

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


? 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

23 Apr, 2024 07:54 PM
19 Apr, 2024 04:41 AM
16 Apr, 2024 06:18 PM
16 Apr, 2024 04:23 AM
08 Apr, 2024 01:28 AM


07 Apr, 2024 11:50 PM
05 Apr, 2024 11:47 PM
05 Apr, 2024 12:30 AM
25 Mar, 2024 08:48 PM
14 Mar, 2024 07:40 PM
14 Mar, 2024 07:38 PM