There are lots of old topics about colours but I just can’t find the answer.
Is it possible to set the general background/text colour on a Glulx game? And make it work with an online game (using Quixe, Parchment or whatever)?
I have worked out the following, but it’s not quite what I need:
- Make individual sentences appear in different colours using Glulx Text Effects by Emily Short.
- Change the background/text colours using CSS.
Ideally I’d like to have commands (maybe like “light theme” or “dark theme”) that would clear the screen and change the colours for the player.
The pendulum has swung (I have swung the pendulum) hard in favor of “this is an interpreter option” rather than “this is a game option”.
Quixe leaves the color entirely up to the page’s CSS file. Therefore, Lectrote is able to provide a universal “color theme” preference by controlling the CSS on the page. The game can’t override that, in Lectrote.
…This implies that I should whip up an I7 template package that replicates this Lectrote preference on a web page. Yeah.
Or you could use fyrevm-web and build custom commands in I7 for emitting text wrapped in your own CSS tags. I do this for hyperlinks in http://plover.net/~dave/cloakjs, source code at fyrevm-web/projects at master · ChicagoDave/fyrevm-web · GitHub, so doing it for text color would follow the same pattern.
Though I’ll mark your comment as the solution as an incentive
I have a feeling that this would work at the text-level but woudn’t be able to change the screen background/text colours more generally. Is that right?
Not at all. You could create channel data to notify the UI of any change you want. That’s the fundamental point of channel IO over glk. You have complete control over the client and it’s look and feel. I’ll whip an addition to the cloak example.
Well, just as an option as a starter or an exemplar or alternative, in addition to Andrew’s point, you can blag the control panel I developed for Worldsmith to customise CSS in game window.
If you download the game, you can view source and everything is in the zip folder (including the color picker).
That looks amazing. What I’ve done is basically a (very) poor man’s version of that!
You can see what I ended up with in the online version of Daddy’s Birthday on Itch. There are just two links – “Dark theme” for the default of white-on-black, and “Light theme” to change to black-on-white.