QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: ZapJackson on July 14, 2018, 03:16:56 pm
-
I apologize if I'm just misreading the documentation, but is there a way to get more than 16 colors in text mode without switching to the 40-column square character shape of screen 13?
-
Hi.
Try this:
-
you can create any size for screen 0 with SCREEN _NEWIMAGE (column, row, 0)
-
@ZapJackson:
You can get all possible RGB combinations assigned to any of the 16 available attributes of screen 0 using _PALETTECOLOR (http://www.qb64.org/wiki/PALETTECOLOR). This way you can use the _RGB32 function as in:
PRINT "This is printed in color 9, which maps to bright blue in the default VGA palette;" PRINT "But now color 9 is Goldenrod."
But you'll still be limited to 16 attributes, 0 to 15. If you want to use *any* color in the 32bit color space, you can switch to graphics mode using _NEWIMAGE. The snippet below creates an 800x600 canvas in 32bit color mode:
This way you can use _RGB32 directly and use all possible combinations of Red, Green and Blue components:
PRINT "This is bright white over goldenrod."
@Petr:
Your code snippet above will only use the existing 16 colors of SCREEN 0, except you're using the _RGB function to select which of the attributes looks *closer* to the RGB values you give. That doesn't really use all possible colors.
-
I am sorry, its my fail.
-
so unless you want backwards compatibility with DOS QBASIC/QuickBasic you can do the following
foregroundColor
= _RGBA32(255,255,255,255)backgroundColor
= _RGBA32(0,0,0,255)
COLOR foregroundColor
, backgroundColor
that might not be entirely correct cuz i wrote it off the top of my head without testing it.
the point is, if youre not going for backwards compatibility, you can just pick a resolution,
set a 32-bit screen mode, and use it in (fake) text-mode. The end user would see no difference other than more colors.