[Inform 7] Changing Background/Foreground Color

Hi all,
I’m a blind gamer and new to coding Inform 7, so expect a lot of questions from me. :slight_smile: Anyway, I have a quick question about Emily Short’s Basic Screen Effects. I know the command “turn the background black” will do just that, but will it automatically change the foreground (that is, the text) to white? Or do I need to do that manually? What about red? See, my objective is to have certain rooms done with white-text-on-black and others with white-on-red. How would it be best to code this? Is “turn foreground white” a thing?

The font color won’t change automatically after changing the background color. You can use “say white letters” (or some other color) to change the font color as per the extension’s documentation.

From a design perspective many players dislike custom background and foreground colors forced by the game, so it’s generally not advisable unless there’s a very good reason for it. Some color combinations (including white-on-red) might also make the text hard to read. At the very least you should get a sighted person to try it out and give feedback.

Oh wow, didn’t know that, thanks! :slight_smile: Is a game of white text on a black background acceptable? If so, would I achieve that by the following:

When play begins:
turn the background black;
say “[white letters]”.

In general, it seems that players prefer to be able to set the colors for themselves unless there’s a game-specific reason why it should be a certain way (e.g. in Photopia by Adam Cadre).

EDIT: Personally, I’m fine with either black-on-white or lighter-color-on-black. Just not things like green-on-red or yellow-on-blue.

You should add a “clear the screen” to the when play begins block as well, otherwise you’ll end up with some of the background white and anything new that’s printed with a black background.

I personally have no problems with white text on a black background. I tend to do most of my coding in editors where I’ve set the background to black and the text colors to contrast well with it.

I suppose I’m partial to white-on-black because I can see it better with my nigh-nonexistant vision. :slight_smile: So then, this would be my code, yes?:

When play begins:
turn the background black;
say “[white letters]”;
clear the screen.

As others have suggested, it would be best to leave it undeclared and then adjust your interpreter for the best contrast.

Got it, thanks. :slight_smile: