Panel color based on boolean value

Is it possible to set a panel color based on a boolean value? i have created an example of what i want to achieve in the picture below.

Check this:

panel_color_c.gh (18.9 KB)

1 Like

where can i find the plugin
image

It’s not a plugin, just the Rhino 8 grasshopper script editor component

This would be super useful in Rhino 7 too - is there a way?

I use the ‘legend’ component, you can feed it color and text. easy.
Screenshot 2024-01-18 at 04.41.58

additionally have a look at metahopper. there some examples posted at the forum in the past.

1 Like

Here’s a Rhino 7 solution that works for a list of named panels:


240118_ColorPanelsBoolean_GHPython.gh (6.1 KB)

7 Likes

Got it. Thanks for the demo!

That’s super slick. Thank you.

1 Like

This code also effects the panels without a title. Is there any way to avoid this?

I’m afraid I can’t reproduce that behavior:

I didn’t test but, check if you entered an empty line in the names list…

1 Like

Hi. Nice and useful script. However looks like I cannot use two of them into the same definition. It is possible to adapt the script so to be able to use two ore multiple instances of this script in the same definition? Thank you.

Can you be more specific? They seem to work fine on my system (Rhino 7 SR37):

1 Like

I have no idea why but looks like in my definition I don’t have the same result. The second instance of the script just don’t change the color of the designated panel in the canvas. I do also use Rhino7 SR37 on Windows11 system.

P.S. Ok, sorry my mistake, I was using a panel with True or False result for the Bool input of the script instead of a Boolean component. Problem fixed, thank you for this script.

Try posting a file and we can have a look.

1 Like

Fixed. See my previous post.

1 Like

This is Rhino 8 and beyond