Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I would like to change the backgound color of my component. My approach was to override the render method in the GH_ComponentAttributes class (e.g. https://discourse.mcneel.com/t/custome-node-color/7427):

        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {

            // Change Color
            GH_PaletteStyle styleStandard = null;
            GH_PaletteStyle styleSelected = null;

            if (channel == GH_CanvasChannel.Objects)
            {
              // Cache the current styles.
              styleStandard = GH_Skin.palette_normal_standard;
              styleSelected = GH_Skin.palette_normal_selected;
              GH_Skin.palette_normal_standard = new GH_PaletteStyle(Color.HotPink, Color.Maroon, Color.DarkRed);
              GH_Skin.palette_normal_selected = new GH_PaletteStyle(Color.SkyBlue, Color.DarkBlue, Color.Black);
            }

       }

This appraoch is almost working.  But if I register custom GH_Params in my pManager of the component, it will fail. Any ideas what I have to consider by using custom params?

Thanks in advance. Cheers,

Daniel

Views: 1042

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service