0 votes
by (310 points)

Hi,

Is there a macro that exists that can change the entire background. To my understanding, (background:) only changes the background of text, much like highlighting it.

I want to change the background colour upon clicking a link that also replaces text and changes the font colour. This is what I have so far:

 

|output>[]

|workarea>[{

(live:  8s)[
		(stop:)
		(append: ?output)[
			<br><br>
			(t8n: "dissolve") + (colour: black) + (text-style: "blink")[
				You should 
				(link: "turn off the light")[(background: black)+(text-colour: white)+(replace: ?output)[That's better.]
				]
			]
		]
	]
}]

When you click the "turn off the light" text, I want the page/passage background to turn black and the "That's better" replacement to turn white. Right now, this works, except for the above-mentioned problem. I've done some digging and couldn't find a solution, or at least one that was anywhere near my understanding. 

I'd also rather stick with Harlowe.

 

Thanks a bunch.

1 Answer

+1 vote
by (159k points)
selected by
 
Best answer

You can use the (enchant:) macro to apply one or more Changers to hooks or strings, and there is a special hook named ?page (mentioned here) which represends the current page (the current tw-story element).

So you can use code like the following to change the background and foreground colours of the current page.

(enchant: ?page, (background: black) + (text-colour: white))


note: You will of noticed I highlighted the word current in the above explanation, this is because changes done using the ?page hook only last until the next Passage Transition at which point the page (tw-story element) will revert back to it's defaults.

...