Need Help with Dark Mode Toggle in Twine 2 Harlawe 3 using JavaScript

Hello, I am somewhat new to Twine, and I’m currently working on a project in Twine 2 Harlawe 3. I’m trying to implement a dark mode toggle feature that saves the user’s preference to local storage, so their choice persists even when they revisit the story.

I’ve been experimenting with JavaScript, but I’m still figuring out how to effectively use it within Twine. If anyone has experience with this or could point me in the right direction, I would really appreciate your guidance!

Is there a specific reason you want to save to localStorage and not to a variable within the game? Harlowe already saves its own variables to localStorage and to the game’s save files, so the setting would be preserved that way.

Are you trying to implement something that lasts through hard game restarts, or which applies to more than one game?

1 Like

@Hituro The first one