OVERVIEW ========= I am writing a console application in C# using the .NET framework. This includes two properties, Console.ForegroundColor and Console.BackgroundColor, which set the output colors for the foreground and background, respectively. However, konsole ignores them completely. STEPS TO REPRODUCE =================== Using System; namespace test_program { class Program { static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Red; // ConsoleColor is an enum, where Red = 12 Console.WriteLine("this text should be red"); } } } EXPECTED RESULTS ================== The text in the WriteLine method outputs in red. ACTUAL RESULTS =============== The text output is in the default color for text (regardless of theme). ADDITIONAL INFORMATION ======================= Konsole version is 18.04.2 Plasma-shell version is 5.13.1 The example C# code above works as expected on other terminal emulators (have tried it on xterm and urxvt). Konsole is in 256 color mode, and things like ls --color=auto also work properly. So does escaping an ANSI code, e.g.: > echo -e "\e[0;31mSome red text\e[0m" Documentation -------------- ForegroundColor: https://msdn.microsoft.com/en-us/library/system.console.foregroundcolor.aspx BackgroundColor: https://msdn.microsoft.com/en-us/library/system.console.backgroundcolor.aspx ConsoleColor (enum): https://docs.microsoft.com/en-us/dotnet/api/system.consolecolor?view=netframework-4.7.1
I only tried the 'echo' statement from above, and it displayed the text in red. Using Konsole master.
(In reply to Christoph Feck from comment #1) > I only tried the 'echo' statement from above, and it displayed the text in > red. Using Konsole master. Right. My point is that it's something specific to how Konsole handles the C# properties, given that other commands work in Konsole while my C# example works in other terminal emulators on the same system.
Are you able to redirect terminal output from the C# program to a file? On UNIX, this is done using the 2> redirection (from stderr), on Windows an equivalent syntax might exist.
If you can provide the information requested in comment #3, please add it.
I compiled the example with Mono 5.10.1.47 and ran it on konsole 17.12.3 and current master. It did work correctly on both versions.
To further investigate this issue, KDE developers need the information requested in comment #3. If you can provide it, or need help with finding that information, please add a comment.
I apologize for the delay, somehow I missed the notification of your reply and got involved in other things. (I'd found a workaround for my program by just using the ASCII escape codes.) Anyway, it now words properly as of konsole version 18.08.1. I appreciate your getting back to me!