[Mono-bugs] [Bug 80330][Nor] Changed - TermInfoDriver ForegroundColor and BackgroundColor don't reflect initial colors
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Mar 6 15:39:35 EST 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by moritz.kroll at gmx.de.
http://bugzilla.ximian.com/show_bug.cgi?id=80330
--- shadow/80330 2007-03-06 00:55:38.000000000 -0500
+++ shadow/80330.tmp.28856 2007-03-06 15:39:35.000000000 -0500
@@ -76,6 +76,59 @@
------- Additional Comments From miguel at ximian.com 2007-03-06 00:55 -------
The idea seems ok, but the problem is that applications might be
confused to get a color that is not the same as the original one.
Maybe we should assume that the "original" color is the pseudo color?
+
+------- Additional Comments From Moritz.Kroll at gmx.de 2007-03-06 15:39 -------
+Well, in the case described above, the application is already
+confused, as it writes unreadable text ;)
+The pseudo color could also cause problems, if an application wants
+to use different color sets for some output depending on the users
+color configuration.
+
+Another way would be to see it from this point of view: The console
+user didn't define the foreground and background color, but how white
+and black should look like. Then the appropriate color could
+be "restored" when you set white for foreground or black for
+background (the other color (background/foreground) has to be set
+again after restoring). However this causes problems if you set white
+for background or black for foreground, as we can't set the correct
+color there. Or is there a way to swap foreground and background
+color with term?
+Still, with this "solution" you wouldn't be able to get real black
+and white colors...
+
+Is there really no way in Linux/Unix to get the current foreground
+and background colors?? I hoped somebody would know a way as I don't
+know much about term.
+
+I just tried the following test on Windows with .NET and Mono
+1.1.16.1 (I know it's old):
+
+ Console.WriteLine("Foreground color: " +
+Console.ForegroundColor);
+ Console.WriteLine("Background color: " +
+Console.BackgroundColor);
+ Console.ForegroundColor = ConsoleColor.Magenta;
+ Console.BackgroundColor = ConsoleColor.Black;
+ Console.WriteLine("Magenta on black");
+
+The output on .NET and Mono on Windows is identical.
+The first run of this program outputs
+
+Foreground color: Gray
+Background color: Black
+Magenta on black
+
+where the last line appears in magenta on black and the second run
+
+Foreground color: Magenta
+Background color: Black
+Magenta on black
+
+where everything appears in magenta on black.
+Also if you change the console colors manually (using the window
+properties) the program outputs the correct colors (on Windows).
+So here any application would be correcly able to use a color set
+compatible to the user specified fore- and background colors.
More information about the mono-bugs
mailing list