From: John den Haan on 18 Feb 2007 14:40 Hello! I was wondering if it is possible to change the color in the console output? And if so, what color gradients are available (how many colors)? -- Cheers, John den Haan joDhn[dot]haEan[at]chLello[dot]nl Remove capital 'DEL' from above addy to obtain e-mail address
From: Alf P. Steinbach on 18 Feb 2007 15:04 * John den Haan: > > I was wondering if it is possible to change the color in the console > output? Yes - check out the console functions, and perhaps also the color command, C:\Documents and Settings\Alf> color /? Sets the default console foreground and background colors. COLOR [attr] attr Specifies color attribute of console output Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the following values: 0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White If no argument is given, this command restores the color to what it was when CMD.EXE started. This value either comes from the current console window, the /T command line switch or from the DefaultColor registry value. The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background color that are the same. Example: "COLOR fc" produces light red on bright white C:\Documents and Settings\Alf> _ > And if so, what color gradients are available (how many colors)? There is a palette of 16 colors, modelling the restrictions of early PC video adapters (console windows were originally DOS program compatibility boxes). I don't recall if you can change the palette. -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
From: Jerry Coffin on 18 Feb 2007 15:24 In article <af976$45d8abd1$d4bb52d9$3185(a)news.chello.nl>, nospam(a)nospam.com says... > Hello! > > I was wondering if it is possible to change the color in the console > output? And if so, what color gradients are available (how many colors)? Yes. For example, SetConsoleTextAttribute can set colors. If memory serves, you get a total of 16 colors each for foreground and background. For each primary color (red, green and blue) you can specify off, on a half intensity, or on at full intensity. -- Later, Jerry. The universe is a figment of its own imagination.
From: Alf P. Steinbach on 18 Feb 2007 16:21 * Jerry Coffin: > In article <af976$45d8abd1$d4bb52d9$3185(a)news.chello.nl>, > nospam(a)nospam.com says... >> Hello! >> >> I was wondering if it is possible to change the color in the console >> output? And if so, what color gradients are available (how many colors)? > > Yes. For example, SetConsoleTextAttribute can set colors. If memory > serves, you get a total of 16 colors each for foreground and background. > For each primary color (red, green and blue) you can specify off, on a > half intensity, or on at full intensity. Sort of. Some such combinations are supported. Supporting all would require a palette of 3^3 = 27 colors, which is more than 16. What's actually supported corresponds to all combinations of RGB with each either off or on, plus an intensity bit (intensity off or on) for the full color. On the original PC's color video adapters you could specify whether the intensity bit should serve as blink or intensity. Unfortunately the default was to serve as blink (blinking text); some people were amazed that my programs had "additional" fancy colors... -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
From: Jerry Coffin on 18 Feb 2007 16:35
In article <53ruatF1tq5q9U1(a)mid.individual.net>, alfps(a)start.no says... [ ... ] > > Yes. For example, SetConsoleTextAttribute can set colors. If memory > > serves, you get a total of 16 colors each for foreground and background. > > For each primary color (red, green and blue) you can specify off, on a > > half intensity, or on at full intensity. > > Sort of. Some such combinations are supported. Supporting all would > require a palette of 3^3 = 27 colors, which is more than 16. What's > actually supported corresponds to all combinations of RGB with each > either off or on, plus an intensity bit (intensity off or on) for the > full color. Yeah -- that's what I get for commenting from distant memory without thinking enough about it... > On the original PC's color video adapters you could specify whether the > intensity bit should serve as blink or intensity. > > Unfortunately the default was to serve as blink (blinking text); some > people were amazed that my programs had "additional" fancy colors... Yes -- I always thought that was a strange default. Blinking text was _drastically_ overused! -- Later, Jerry. The universe is a figment of its own imagination. |