Create random colors?

I want to create random colors. It’s a list based on six discrete fRGB values:

0, 0, 1: red
0, 1, 0: green
0, 1, 1: yellow
...
1, 1, 1: white

So I was thinking I start with a random number, then use bitwise operations, but there seem to be no bitwise operations in Grasshopper. :frowning:

Any suggestion?

Copy the left part three times, connect the three outputs to a Point component then you won’t even need the right side :wink:

Can you elaborate? Just feeding individual random numbers into R, G, and B won’t work, because then I would also get 0, 0, 0, which I don’t want and which my solution avoids.

Yeah, I didn’t think that through, I am on the phone.

I’ll create something now and posted here.

unnamed.gh (12.1 KB)

1 Like

You can just use the 3 seeds in one random component, then use explode tree (BANG) after the random component.

2 Likes

theoretically it should’ve worked with my original idea to add them into a point component. but now I see the point has curly brackets while the color doesn’t. :slight_smile: disappointing.

Or for real random values use Random component from Heteroptera.

I hate using 3rd party plugins

Random can output integers so you can use that. Right click on components. One Random is enough

Or another solution


colors_LD.gh (18.2 KB)

1 Like

@ivelin.peychev The solution you posted in the picture also includes black. (0, 0, 0)

My proposal would be super easy to code and it would work. Just in Grasshopper it’s a pain. Are there really no bitwise operations?

Thanks for the suggestion. Now without black.

If you just want to keep a list of 6 colors, keep it in a list, duplicate the list and use Jitter component !

1 Like

You can also use the Colour Wheel and feed it the number of colors you want in your palette.

2 Likes

I don’t know what that means :baby: :baby_bottle:
:slight_smile:

I don’t understand how to create the six RGB colors red, green, yellow, …, and white easily with the color wheel. It seems again another cumbersome solution.

image
Cumbersome?

Well try creating: red (255, 0, 0), green (0, 255, 0), yellow (255, 255, 0), …, white (255, 255, 255)

Do you only need these colors?
Then use what @laurent_delrieu suggested

If you just want to keep a list of 6 colors, keep it in a list, duplicate the list and use Jitter component !

^^that’s the way to go by @laurent_delrieu

1 Like