Re: Console Colours

Mike A. Harris (mharris@ican.net)
Sat, 13 Mar 1999 12:54:32 -0500 (EST)


On Sat, 13 Mar 1999, Robin Grayson wrote:

>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.
>
>I can set all the 'bright' foreground colours as follows:
>
> echo -e "\033[30;1m" = Gray
> echo -e "\033[31;1m" = Bright Red (Pink)
> echo -e "\033[32;1m" = Bright Green
> echo -e "\033[33;1m" = Yellow
> echo -e "\033[34;1m" = Bright Blue
> echo -e "\033[35;1m" = Bright Magenta
> echo -e "\033[36;1m" = Bright Cyan
> echo -e "\033[37;1m" = Bright White
>
>but if I try these for the background:
>
> echo -e "\033[40;1m" = Black b/g Bright White f/g
> echo -e "\033[41;1m" = Red
> echo -e "\033[42;1m" = Green
> echo -e "\033[43;1m" = Brown
> echo -e "\033[44;1m" = Blue
> echo -e "\033[45;1m" = Magenta
> echo -e "\033[46;1m" = Cyan
> echo -e "\033[47;1m" = White
>
>I get the base colours, not the 'bright' version of them.

The VGA text mode hardware has an attribute for the background.
This attribute normally is "flash" so when set, you'll get the
standard foreground color + flashing. If you want 16 background
colors, you need to change it so that it interpret's the
attribute bit as highcolor instead. I don't remember how this is
done, but I think it can be done either by echoing something to
the console, or by "setterm".

This is how programs like Norton Commander get 16 color
background colors.

I'll leave the details for someone else...

--
Mike A. Harris                   Linux advocate      GNU advocate
Computer Consultant                          Open Source advocate  

The DVORAK keyboard layout RULES! I memorized it in 45 minutes and I don't think I'm ever going back to QWERTY!

- 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/