Change Rhino background colour from GHPython?


Would changing the colour of the Rhino canvas/background be possible from the GHPython component?
And if so, how? I would also be interested in turning the grid on and off in GHPython.

The colour and grid display shouldn’t be changed permanently, but should roll back to their defaults, when the next Grasshopper script or Rhino file are opened.

Any ideas, guys?

Thank you and have a nice week-end everybody!

This might help:

Thanks, however I’m not looking for a solution to change the Grasshopper canvas, but the Rhino background and grid from GHPython. Any ideas?

You can set these from GHPython through Rhino.ApplicationSettings.AppearanceSettings. You probably want the ViewportBackgroundColor property.

1 Like

When I call print ra.AppearanceSettings.ViewportBackgroundColor it seems to print the rgba values for the current background, which is great.
However, when I try to change the background, by calling ra.AppearanceSettings.ViewportBackgroundColor(my_colour), where my_colour is a swatch input, it tells me that “color is not callable”.

Do you you know what I’m doing wrong here. The documentation states that it should be able to set and get the background colour.

Since it’s a property (i.e. not a method) you assign it using an equals sign.

1 Like

Thank you, it works perfectly.

1 Like