OpenBSD framebuffer console and custom color palettes

Frederic Cambus June 06, 2020 [OpenBSD]

On framebuffer consoles, OpenBSD uses the rasops(9) subsystem, which was imported from NetBSD in March 2001.

The RGB values for the ANSI color palette in rasops have been chosen to match the ones in Open Firmware, and are different from those in the VGA text mode color palette.

Rasops palette:

Rasops palette

VGA text mode palette:

VGA text mode palette

As one can see, the difference is quite significant, and decades of exposure to MS-DOS and Linux consoles makes it quite difficult to adapt to a different palette.

RGB values for the ANSI color palette are defined in sys/dev/rasops/rasops.c, and here are the proper ones to use to match the VGA text mode palette:

#define	NORMAL_BLACK    0x000000
#define	NORMAL_RED      0xaa0000
#define	NORMAL_GREEN    0x00aa00
#define	NORMAL_BROWN    0xaa5500
#define	NORMAL_BLUE     0x0000aa
#define	NORMAL_MAGENTA  0xaa00aa
#define	NORMAL_CYAN     0x00aaaa
#define	NORMAL_WHITE    0xaaaaaa

#define	HILITE_BLACK    0x555555
#define	HILITE_RED      0xff5555
#define	HILITE_GREEN    0x55ff55
#define	HILITE_BROWN    0xffff55
#define	HILITE_BLUE     0x5555ff
#define	HILITE_MAGENTA  0xff55ff
#define	HILITE_CYAN     0x55ffff
#define	HILITE_WHITE    0xffffff

And here is a diff doing just that, which I sent to tech@ back in January 2017.

EDIT: The enthusiasm around this article led me to make another try, which didn't fare any better.