QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: bplus on September 06, 2018, 12:11:10 pm
-
I want to get current color settings for screen before using COLOR in sub so that I can set the color back to what it was before the sub call.
Is there a way?
I am sure there are probably 10 but I don't know of an easy one except save the colors myself when I reset them.
The sub is meant to be reusable in anyone's program, like the list box for a selection from array.
-
_DEFAULTCOLOR for fore color and _BACKGROUNDCOLOR for, you guessed it, back color.
-
Knowing Fellippe that 's likely the best answer, I calculate the bias at 99.9%
Thanks Fellippe!
-
In the old days, when you were still part egg, the way to do it was to print a hidden character, like chr$(0), in an unused place on the screen and then use the 1 switch in the SCREEN command to read the attribute of that character. Then you had to divide it by 16 and use mod 16 to find the foreground and background colors, and, of course, remove the hidden character.
Yeah, I know we're roughly the same age, but I couldn't resist cracking that egg joke, and since it was about being part egg, let's just leave it at the yolks on you.
Pete :D
- Dammit, I miss my smileys!