Author Topic: What is the 3rd argument of COLOR used for?  (Read 1397 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
What is the 3rd argument of COLOR used for?
« on: January 07, 2021, 06:00:59 pm »
I was wondering what the 3rd optional parameter of the COLOR statement is used for.  I've only ever used the first 2 parameters - foreground and background.  COLOR accepts a 3rd one, and expects a number, but I don't know what it's for.  It's not mentioned in the wiki.  Like below, what would the 23 do?

COLOR 7, 1, 23

- Dav

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: What is the 3rd argument of COLOR used for?
« Reply #1 on: January 07, 2021, 06:15:32 pm »
QBasic only accepted 2 parameters. The third on, accepted in QB64 does not seem to do a damn thing. It can be negative or positive, but it still doesn't seem to do a damn thing. I was hoping it was for transparency. Maybe it's a bug or sorts, allowing it, or maybe it needs some other statement to implement it. Sorry I can't be more helpful It was a surprise to me, too.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: What is the 3rd argument of COLOR used for?
« Reply #2 on: January 07, 2021, 06:15:58 pm »
Code: [Select]
COLOR [foreground][,[background][,border]] in SCREEN 0. The manual goes on to say
Quote
The border color-the color used to draw the screen
               border-is an integer expression in the range 0-15.
               The IBM Enhanced Graphics Adapter (EGA), the IBM
               Video Graphics Array adapter (VGA), and the IBM
               Multicolor Graphics Array adapter (MCGA) do not
               support the border argument.

I suspect QB64 just ignores the value.
« Last Edit: January 07, 2021, 06:18:21 pm by luke »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: What is the 3rd argument of COLOR used for?
« Reply #3 on: January 07, 2021, 06:39:25 pm »
I vaguely recall something like that in TI and/or Atari Basic, and I just looked it up in the MS Quick Baisc manual (a different text from the Qbasic one I referenced in my preceding post). You could, as luke stated, the third parameter to change the border around the window of the program. The manual did not give a range, but I would imagine it would be 0 to either 7 or 15.  In the MS Quick Basic text, it shows this as a SCREEN 0 only "feature" as luke pointed out. My guess is I tried it once, and was so NOT impressed, I never bothered to code anything with it, and I would not care to see QB64 support it, anytime soon. As of now, I agree with luke, that QB64 just ignores it.

Oh, Quick Basic COLOR in SCREEN 1 is listed as 2 parameters. The first is the foreground, but get this, the second is the palette. SCREEN 1? :D :D :D

Pete   
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: What is the 3rd argument of COLOR used for?
« Reply #4 on: January 07, 2021, 06:43:46 pm »
Ah...now I kind of vaguely temember that too.  I guess QB64 allows it to be compatible with old code.  Thanks, @luke.

I like your idea of transparency, @Pete! Might as well put the parameter to use!

Thanks, guys.

- Dav