0

Im trying to change the color of the console (WHICH IS POSSIBLE!) with this code:

COLOR 7
PRINT "Color 7 is gray"
K$ = INPUT$(1)
_PALETTECOLOR 7, &HFFDAA520 ' FF alpha makes the color translucent
PRINT "Color 7 is now Goldenrod in SCREEN 0!

However when running it, I get an error Message. Not to mention that the color doesn't change.

What is the proper way to do this?

The code: http://www.qb64.net/wiki/index.php?title=COLOR

Roke
  • 300
  • 1
  • 6
  • 27
  • 1
    Best tell us what the error message is. Did you even select SCREEN 0? – Sep Roland Nov 01 '15 at 22:29
  • 1
    Don't these messages come with a source line number? – Sep Roland Nov 01 '15 at 22:38
  • 1
    You are compiling/running this with QB64 and not trying to compile/run this with an original copy of QBasic/QuickBASIC in something like DOSBox or the Windows console, right? The keywords with a `_` prefix (e.g. `_PALETTECOLOR`, `_FULLSCREEN`, and more) are QB64-only keywords, so they won't work in QBasic or QuickBASIC. To do this in this in QBasic/QuickBASIC, you'd need to use `OUT &H3C8, 7: OUT &H3C9, &HDA / 4: OUT &H3C9, &HA5 / 4: OUT &H3C9, &H20 / 4`. That will set `COLOR 7` to the "goldenrod" color, and `COLOR 7` is the default foreground color for screen 0 IIRC. –  Nov 02 '15 at 04:02
  • 1
    IDK how new `_PALETTECOLOR` is...but maybe you need to download a new version of QB64? If you're not using QB64, you can still use [the documentation the QB64 Wiki provides for manipulating colors using `OUT`](http://www.qb64.net/wiki/index.php/OUT). To convert 32-bit RGB values like #FFCC99 to the range 0-63 (&H0 - &H3F) that QB requires, just divide each color component (each of RR, GG, and BB in #RRGGBB) by 4, so #FFCC99 would be `&HFF / 4`=`&H3F`, `&HCC / 4`=`&H33`, and `&H99 / 4`=`&H26`. Refer to the QB64 Wiki and its examples to use those values. –  Nov 02 '15 at 04:02
  • Thank you for putting QB64 in mind. I was doing this with QBASIC. – Roke Nov 02 '15 at 20:19

1 Answers1

1

Sorry bout the commotion.

Chrono answered this question.

You have to run it with QB64, not QBASIC. This code works for QB64, not QBASIC.

:(

Roke
  • 300
  • 1
  • 6
  • 27