Multiple ellipsis in different colors
Hi, I have multiple ellipses and I want to color all the ellipses with number 40, in red. I want to do the same thing for all the others.
Can anyone help me?
Thank you in advance.
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by john on 27 Dec, 2018 07:24 PM
The basic technique is to feed your list of ellipses into a colorize node and feed a list of colors into the fill port of that colorize node. If the two lists have the same number of items, the first color will go to the first ellipse, the second color to the second ellipse, and so forth.
The trick, then, is to form that list of colors.
Apparently you also have a list of numbers which you are placing next to each ellipse. If you wanted to color all ellipses associated with the number 40 red and all others, say, black you could use a switch node.
Feed your list of numbers into a compare node to test whether each value is equal to 40. Feed that list of booleans into the the rightmost index port of the switch node; false will read as 0 and true will read as 1. Feed a black color into the first (false) node of the switch and red into the second (true).
The result will be a list of colors, red when the ellipse number is 40, black otherwise. Feed that into your colorize node and you're done!
You said you want to "do the same thing for all the others". I'm not sure what you meant by that. If you want to assign each value a different color across a spectrum, or across a finite set of colors, you will need to create a set of nodes (or a subnetwork) to convert each value into a color.
The convert_range and hsb_color nodes are handy for this. Feed your list of values into the convert_range node to convert each one into a value along a range of the color spectrum and feed that into the hue port of the hsb_color node. Voila! A list of colors for your colorize node.
I made a demo showing both methods (screenshot and file attached).
Let me know if this helps. If you're still stuck please attach a zipped copy of your NodeBox network along with a description of how you want to assign the numbers to different colors and I will help you figure it out.
2 Posted by Aricia on 28 Dec, 2018 05:50 PM
Thank you John. This helped me a lot.