Change Command Prompt single line color

I would like to print some lines in different text color (like info, or warnings) I’ve realized that VisualArq is printing some lines in a different color

I tried to change setting the color by Rhino.ApplicationSettings.AppearanceSettings.CommandPromptTextColor
but it changes all text color (including already printed text), @enric or @kike could you let me know how did you do it for a single line or word?

Thanks and Regards

1 Like

The command history window is a RichText edit control, if you want to override the color for specific strings you will need to embed the RTF codes for specific colors in the text you pass to RhinoApp().Print.

Thanks for the info @JohnM,

I tried the following but it doesn’t work:
RhinoApp.Write("<color=#ff0000>Red Text</color>");
it just print the line as is <color=#ff0000>Red Text</color> in command prompt

I also tried RhinoApp.CommandLineOut.Write() with the same result.

Using a header and defining a color table like that:
@"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red255\green0\blue0;} default color\line \cf2 red color}" doesn’t print anything.

Could you show me any example?

Thanks in advance!

Hi @Harper,

As @JohnM has pointed out, the command histyory window is a Microsoft Rich Edit control. I don’t know ifusing RhinoApp.CommandLineOut.Write() will work, as we are using the C++ SDK, and as far as I know, using the normal CWinApp::Print() fucntion didn’t work when we implemented this 10 years ago.

What we do is find the window handler (HWND), then get the attached CRichEditCtrl MFC control, write the text normally, and finally use the method CWnd::SetSelectionCharFormat() to change the format of the written text.

I think this could be done in C# also. The Windows Message to change the format is EM_SETCHARFORMAT with the flag SCF_SELECTION.



Please DO NOT depend on Rhino working this way in the future.

Hi @stevebaer,

This is just a cosmetic feature and we obviously do not depend on this, as if anything fails getting the CRichEditCtrl, we just fallback to the default CRhinoApp::Print().


It worked like a charm! Thanks for the help @enric!!