Messages in this thread | | | Date | Sat, 13 Mar 1999 09:18:18 -0800 (PST) | From | Simon Kirby <> | Subject | Re: Console Colours |
| |
On Sat, 13 Mar 1999, Robin Grayson wrote:
> This may be a stupid question, but how can I set a gray background colour in > Linux? > > I am running kernel 2.2.3 > > If i use echo -e "\033[30;1m" I end up with a gray foreground, but if I do > echo -e "\033[40;1m" I end up with black b/g bright white f/g.
Standard VGA initializes in a mode where background colors past the lower half of the nibble display just as the lower half of the nibble but the foreground colour is blinking. The actual attribute byte broken into bits is as follows:
msb -> Bbbbffff
Where "ffff" is the foreground colour, "bbb" is the background, and "B" is the foreground blink enable bit.
There is another mode that can be set on VGA hardware that makes the "B" bit turn into a most significant "b" bit where you can have the entire nibble for the background colour and thus have any foreground colour as any background colour.
I'm not sure if there's a way to make the console code set this mode, but I know that SVGATextMode has an option in its config file for it ('Option "16color"').
Once this is set, enabling the blink bit where needed will allow for the "bright" end of the background colours to be set, so you can access gray which is colour 8 (or ANSI colour 1;30). The "intensity bit" for the background colour now becomes the blink bit, though, so you'd set the background colour like this: \033[5;30m
I have no idea how portable this is, as I'm only familiar with x86 hardware.
Hope this helps. :)
Simon-
| Simon Kirby | Systems Administration | | mailto:sim@netnation.com | NetNation Communications | | http://www.netnation.com/ | Tech: (604) 684-6892 |
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |