# Grasshopper color coding true false pairs

Hello.
I am sorting through some data that results in two pairs of True False responses. I’m trying to now color code the results (as shown in the attached image with the unconnected swatches) so that the four resulting options each have a separate color.

Thank you in advance for your help,

Merge/Entwine your color swatches to match the branching.

Thank you. And from there how do I get the swatches to define the four possible outcomes?

roughly speaking

you probably will need something more like one of these options

You can do this in a quite elegant way, by thinking of your two values as two positions in a binary bit flag. so:

``````False,False = 00 in binary = 0 in decimal
False,True = 01 in binary = 1 in decimal
True,False = 10 in binary = 2 in decimal
True,True = 11 in binary = 3 in decimal
``````

We can calculate the decimal value by multiplying the first boolean by 2 and adding it to the second.
(True,True = 1,1 => 1*2 + 1 = 3)

Then we can order our list of colors such that their indices match the desired binary combination:

in a full example with data:

6 Likes