How about colors and terminal graphics in std.format?

Adam D. Ruppe destructionator at gmail.com
Sun Mar 11 20:42:24 PDT 2012


On Monday, 12 March 2012 at 03:30:09 UTC, Damian Ziemba wrote:
> Those numbers are for Windows btw :p

It is also the way the VGA hardware works... and it
is actually a really simple bitfield for a four bit
color.

The attributes are a ubyte like so:

back_fore
lrgb_lrgb


where l is a bit meaning "light" or bright.

That's where the colors come from:

blue = 0001 == 0x01
green = 0010 == 0x02
red = 0100 == 0x04

combine them. yellow is red + green

yellow = 0110 == 0x06

Bright purple is bright | red | blue:

1101 == 13 == 0x0d


On the vga hardware, a "light background" meant
blink.




More information about the Digitalmars-d mailing list