Change color Message in Component.Message?

Hello, how does the background color of this part of the messag change?
Component.Message="";

in VisualStodio Or c# Componenet?
color

I was also curious about this, but it seems that the color is determined by following method and cannot be specified directly by the user.

The first argument (style.Edge) is the color of the component’s edges, and the contrast against it seems to determine the text color.

public static Color ForegroundColour(
	style.Edge, 200
)
3 Likes

Correct, the colour of the label is identical to the colour of the capsule edge.

3 Likes

Hi, I’m testing but still not changing the color!

 
  public void ForegroundColour(Color color, int size)
    {
        // Your implementation here (currently missing in your code)
    }
  private void RunScript(Color color, ref object a)
  {
      Component.Message = "Test";
        ForegroundColour(color, 50);
    a = null;
  }
}

Color M.gh (8.9 KB)

I was referring to Grasshopper’s “internal” implementation.
So if you want to change the color of a message, you can only do so as a side effect by changing the color of the capsule’s edges.

It cannot be changed directly using the method ForegroundColour.

The following page provides a sample of how to change the edge color of the capsule, but it is not possible to do so from the C# Script component.

Yeah, sounds like you’ll have to draw those labels yourself from scratch from your attributes.