Change Page Colour (not Background)

How can I change the colour of the page (pop-up backgrounds and map background) but not ruin or change the blend?


For the map background: (Edited, forgot to put in JS in front of code.)
JS.setCss ("#gridCanvas", "color:green;background:yellow;font-weight:bold;padding:8px")

Looted the code from https://textadventures.co.uk/forum/quest/topic/yk6mhadniums1r4cfnpnbg/help-pop-up-window

About the pop-up background, I do not know, the codes below looks alright but the funny thing is it does not works, as it seems to change number every time play game button is pressed.
JS.setCss ("#spade526935525", "color:green;background:yellow;font-weight:bold;padding:8px")
JS.setCss ("#divOutputAlign9", "color:green;background:yellow;font-weight:bold;padding:8px")


The number is random. It needs to be different for every popup so the script will work; so Quest adds a random number to the ID.

The easiest way to change the popup background would probably be changing game.defaultbackground before outputting it.


Game default background would override a blend. If I could change the page colour and not cancel the blend, or even interrupt the blend, and then get it back, that would be fun, but also to be able to have seperate background colours for the map alone would be nice.


Game default background would override a blend.

Would it?
Blend overrides defaultbackground; if you specify a blend, defaultbackground is used only for popups, the map background, and the command bar.

The background colour of popups is determined by the value of defaultbackground when they are output; the colour of the command bar is determined by the value of defaultbackground at the end of the turn; and the colour of the map is determined by the value of defaultbackground when the game is loaded. So unless you specifically change it, modifying the value of defaultbackground will be localised.

You got me doubting myself, so I tested it.
This script outputs a popup with a purple background, and turns the command bar purple, but has no effect on the background blend or the map:

game.defaultbackground = "violet"
msg ("Click {popup:here:Wow! So purple!} to see a popup with a purple background.")

While this one makes a purple popup, but doesn't change the colour of the command bar:

oldbackground = game.defaultbackground
game.defaultbackground = "red"
msg ("This {popup:popup:See, red!} has a red background, but nothing else has changed.")
game.defaultbackground = oldbackground

And because I was feeling silly, I also tried this:

old = game.defaultbackground
game.defaultbackground = "green"
inner_popup = ProcessText("{popup:click two:Here's some green!}")
game.defaultbackground = "red"
msg ("And this is what happens when you mess about with popups in popups: {popup:click one:here's the link - " + inner_popup + "}")
game.defaultbackground = old

Which… doesn't behave as intended. (It exposes a glitch in the popup javascript… but what it does is actually kind of interesting)


Thanks, Darin, for the script that changes gridmap background. It isn't what I was looking for at the time, but I have just now made good use of it.


Log in to post a reply.

Support

Forums