Qbasicnews.com

QBasic => QB Discussion & Programming Help => Topic started by: Ralph on February 12, 2007, 02:42:18 AM



Title: COLOR fg, bg
Post by: Ralph on February 12, 2007, 02:42:18 AM
The QuickBASIC Help, Index, COLOR statement, double click, shows that, for SCREEN 11-13, COLOR only allows the foreground color, thus:
COLOR  foreground.

But, if we use this first
WIDTH 80,25 'or 30, or 43, or 60
we can then use
COLOR foreground, background
Furthermore, the foreground (or background) colors aren't limited to 0-7, but can be 0-31.  How about that?  This enables a blinking foreground.

I don't remember using or seeing this used before.  Is this something new for most QBers here, or is this just old stuff?


Title: COLOR fg, bg
Post by: Radical Raccoon on February 12, 2007, 02:55:25 AM
old stuff


Title: COLOR fg, bg
Post by: Antoni Gual on February 12, 2007, 05:00:42 PM
Up to 31 colors?  I can't see how!
PC text Screen attributes save the foreground color in one byte per character: 4 bits for foreground and 4 bits for background. This gives 15 colors for foreground and 15 for background. The 7 upper colors for the foreground are bright colors, while for background you can set a bit somewhere to decide if the 7 upper colors are bright or blinking.
This is how the BIOS text screen works, and how Windows should emulate it


Title: COLOR fg, bg
Post by: Ralph on February 12, 2007, 10:37:48 PM
Antoni:

Sorry that I said "31 colors".  What I meant was that we could use 0-31 for the foreground numbers following the COLOR statement, giving the 0-7 colors, 8-15 "bright", or "light" colors, and, by using any of those 0-15 colors with the addition of 16 (which gives the 16-31), those first 0-15 colors are blinked on and off.

I found that, for the background, only 0-15 could be used.