Keep change to slider background color persistent

Hi Guys,

When I change the background color of a slider, it is automatically set back to its original color when the component its connected to expires its solution, and when the slider itself expires its solution ( When a value its changed or when moved)

The component which the slider is connected to is the one responsible for changing the sliders background color.

I have tried the following:

             IGH_Param input = (Params.Input[1].Sources[0]);
             slider = (GH_NumberSlider)input;

            if (slider != null && programType!=null)

                Color c = Color.FromArgb(255, programType.ProgramColor.R, programType.ProgramColor.G, programType.ProgramColor.B);
                slider.Slider.ControlBackColour = c;

                slider.Slider.DrawControlBackground = true;

                slider.Slider.ValueChanged += Slider_ValueChanged;

        private void Slider_ValueChanged(object sender, Grasshopper.GUI.Base.GH_SliderEventArgs e)


That works fine except that whenever I start to change the slider value it gets extremely slow and not interactive like it should be.

A very ulgy test that I did was to code a separate C# script component that looks for all the components in the grasshopper doc which take care of the sliders color and then expire their solution one by one. Although this works, its definitely a no, no and I am pretty sure there is a better way to achieve this.

 private void RunScript(bool Run, string Name, ref object A)

    int count = 0;

    List<IGH_DocumentObject> components = new    List<IGH_DocumentObject>();
    foreach (IGH_DocumentObject obj in GrasshopperDocument.Objects)

      if(obj.Name == Name)




    foreach (var item in components)
      if(Run) item.ExpireSolution(true);

    if(count == 0)
        "The specified component does not exist in the canvas!");

    Component.Message = "Expire";

    if(Run) Component.ExpireSolution(true);

    A = components;

This is the slider background that I am changing…

Thank you and any tips would be very helpful