Update to Colors Node

john's Avatar

john

08 Dec, 2023 09:14 AM

NOTE: The version attached to this post had a bug in it that limited how random the colors were. SEE MY REPLY FOR THE CORRECTED UPDATE!

Short version:

The Colors node has a new Random mode that can produce a much wider variety of colors. Play with the demo to see how it works.

Long version:

The colors node is one of the simpler nodes in my node library. It works just like the sample node: give it start and end colors and it will spit out as many colors as you want in between. It's handy for quickly coloring elements as you are working on a project so you can tell things apart. (You can fine tune the colors later if you want using my new palette node.). The colors node is not fancy, but it's quick and easy.

The colors it produces are a simple linear interpolation between the hue, saturation, brightness, and alpha values of the start and end colors. This is often all you need - and you can even shuffle them if you want - but it's not a full-fledged random color generator. If you want to use it to quickly step through zillions of possible variations in search of a surprising new overall effect, the colors produced will be evenly spaced relative to each other and so will produce only a small fraction of all possible color combinations.

For this latter use case I have added a new "Random" mode. If you check the Random checkbox, the colors produced will still fall within the boundaries defined by the start and end colors, but will no longer fall along a straight line between the two.

So now there are two checkboxes: Random and Shuffle.

  • If you leave Random unchecked, Colors will function just as it did before.
    • Changing the seed value will have no effect unless "Shuffle" is checked.
    • If Shuffle is checked, each change to the seed will produce the same linear colors but in a different order.
  • If you check Random, the colors will be random and will no longer be evenly spaced - anything goes as long as the values fall within the boundaries established by the start and end colors.
    • If you leave "Shuffle" unchecked, the random colors will be arranged in a rough order based on their "distance" from the start value; they will still progress from start to end but will no longer be evenly spaced. If you change the seed value, new random colors will be picked but will still be arranged in this rough distance order.
    • If you then check Shuffle, the current random colors will be rearranged. But changing the seed value will now change both the random colors AND the shuffle order.

If you want to use the colors node to generate all possible colors and transparencies, set the Start Color to #00000000 and the End Color to #ff0006ff (saturation, brightness and alpha at 255, hue at 254 - since a hue of 255 reads as 0). You will then be choosing among over four billion possibilities for each color (though most will be dark and/or faint).

The attached demo shows a the colors node attached to a simple color table. Change the settings and see what happens to the values in the table. With Shuffle off, Linear mode produces a smooth and steady interpolation of values down each column. When you check Random, the values still rise or fall in each column, but no longer do so evenly. Step through various seed values to see them fluctuate.

With the addition of this new checkbox, the color node can now be used just like the random_numbers node - but for colors.

  1. Support Staff 1 Posted by john on 08 Dec, 2023 04:54 PM

    john's Avatar

    Oops!

    I found a bug in the colors node I posted above that caused the random colors not to be nearly as random as they could be.

    Fixed. Now, when you choose the Random option, you will get a much wilder mix of colors.

    If you have already downloaded the previous version, toss it and use the one attached to this post instead.

    Sorry about that.

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • Updated_Colors_Node_Screenshot.png 351 KB
  • updated_colors_node.ndbx.zip 5.05 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

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

10 Sep, 2024 03:41 AM
09 Sep, 2024 02:15 PM
07 Sep, 2024 05:16 AM
05 Sep, 2024 02:21 AM
04 Sep, 2024 05:01 AM

 

03 Sep, 2024 10:07 AM
02 Sep, 2024 05:56 AM
31 Aug, 2024 11:07 PM
27 Aug, 2024 12:08 AM
26 Aug, 2024 01:02 PM
26 Aug, 2024 07:18 AM