Subject: Patch to change console colors
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-kern
Date: 07/22/2004 23:30:13
Hi,

I've added support to change console colors with wsconsctl.  The reason is
that I didn't like black on white on the mac68k port and wanted to change it.
I know, this patch does not address that architecture yet, as I want a review
first.  (Oh, and FreeBSD can do it through vidcontrol).

To get an idea, the following is added to wsconsctl:

dawn:/home/jmmv# wsconsctl -d -a | grep msg
msg.default.attrs=16
msg.default.bg=4
msg.default.fg=7
msg.kernel.attrs=18
msg.kernel.bg=4
msg.kernel.fg=3

msg.default.* variables specify how the console looks, while msg.kernel.*
do the same for kernel messages.  You can see that I actually have white
on blue console and yellow on blue kernel :)

Two ioctl's are added to wsdisplay devices: one to get all those values and
one to set them, all through a single structure.  All the user-tunable stuff
is optional by defining WSDISPLAY_CUSTOM_OUTPUT, which is a default in
GENERIC kernels (except TINY) and disabled on installation media.  Even if
this is not defined, one can still set values for colors from kernel options
(just as now for kernel messages), namely WS_DEFAULT_* and WS_KERNEL_*.

Also note that this tries to be device independent.  There are no changes
in the underlying device, except for the addition of the replaceattr function.
I've made it optional as you get good results without it; the only difference
is that having the function changes the visible screen to the new attributes,
while without it you have to do a 'clear' (or scroll it enough with new stuff).

The preliminar patch is in:

	ftp://ftp.NetBSD.org/pub/NetBSD/misc/jmmv/msgattrs.diff

Any comments will be welcome!

BTW, I've removed the distinction between WS_KERNEL_{COL,MONO}ATTR in favour
of WS_KERNEL_ATTRS, but I'm starting to think that this was not a correct
decision.  Should I "undo" this part?

Thanks!

-- 
Julio M. Merino Vidal <jmmv@menta.net>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/