I have my story formatted as white text on a black background. For a part of the story, I want to switch to black text on a white background. I want to do this using a format variable, as in:
(set: $transcriptFormat to (font: "Times New Roman")+(color: black)+(background: white))
However, this only changes the background of the line of text I attach it to. Is there a way in Harlowe to use macros to change the background of the body text? Or will I have to switch to CSS? I ask because I don't want to repeat the same lines of HTML and CSS at the beginning of each passage I want to apply this format to.
Thanks!
Comments
You can set your default background and foreground colours using the following CSS:
(note: the background-color needs to be set on the body tag if you want it to effect the whole page.) If you were using the SugarCube story format you could use passage tag based CSS selectors to change the look of groups of passages by simply adding the same passage tag to each member of the group, this feature was available in most Twine 1 story formats. Unfortunately Harlowe does not currently support passage tags.
One possible way you can achieve a similar effect is by using a little javascript to assign/remove a class and a missing image hack to call the javascript. The downside of this method is the change in look persists until you manually turn it off.
Turn the new look on by add the following to the first passage you want to look different, it adds a class to the html element of your story: You can then write CSS that will change the look of the page when the class exist on the html element: Turn the new look off by adding the following to a passage when want the look to return to the defaults, it removes the class from the html element of your story: I hope that helps, someone else may be able to come up with a better workaround.
Or is there a simpler way now that Twine/Harlowe has seen some minor upgrades?
Which Harlowe minor upgrades are you asking about?
a. The ones that are part of Harlowe 1.0.1, that comes as part of Twine 2.0.3 or
b. The ones that are part of Harlowe 1.1.0, which has not been released yet and is still being changed?
Would love to just use CSS.
I think I read it was possible in Twine 1 by using tags... How can this be done in Harlowe?
Leon has now released a beta version of Harlowe 1.1.0 which includes the ability to tag passages as either a header or a footer which may allow you to make global style changes based on the passage being shown.