Trouble with 24 bit RGB in Windows consoles #4187
Replies: 2 comments 22 replies
-
Can you provide some more information please.
Are you trying to mix native console write code while Terminal.Gui is running? or after Shutdown? when did your code stop working? Just after adding a reference to Terminal.Gui or after initialization? The normal way to get true color in Terminal.Gui is to set the color in your view using SetAttribute: private class MyView : View
{
/// <inheritdoc />
protected override bool OnDrawingContent (DrawContext? context)
{
SetAttribute (new Attribute (new Color (232, 112, 23), new Color (23, 255, 51)));
Move (0, 0);
AddStr ("Hello");
return true;
}
}
private static int Main (string [] args)
{
Application.Init (null, "v2");
var w = new Window ();
w.Add (
new MyView ()
{
Width = 10,
Height = 10,
});
Application.Run (w);
Application.Shutdown ();
return 0;
} |
Beta Was this translation helpful? Give feedback.
-
On the plus side, I'm making great progress with mouse events (one of my primary reasons for switching to Terminal.Gui). I just got the scroll wheel working smoothly in my editor. Great library! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Before I switched to Terminal.Gui I had success in Windows cmd console and PowerShell using ANSI control characters for true RGB colour.
Now I'm seeing the correct colours when I run from the Visual Studio debugger but not when I run from the consoles (cmd and PowerShell) on Windows. I'm publishing to a single file executable but I have verified that the same problem exists if I don't use single file.
Left to right: cmd, PowerShell, debug console from Visual Studio.
Thanks again for your help.
Note: the colours are perfect when I publish to a single file binary for Linux (running on my Chromebook).
Beta Was this translation helpful? Give feedback.
All reactions