Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Changing between 2 CSS settings

So I'm looking to try and change CSS sheets based on a true false variable so I can go between black background and white text/white background and black text.

I'm using Harlowe and I've been looking for a solution for a while but I just haven't been able to find anything. Help please?

Comments

  • You may want to look at the Basic Harlowe Passage Tag Based Styling thread.

    If you want to use a variable instead of tags then:

    a. If you want the colour change to occur on the next Passsage the reader navigates after the variable changes value then change the contents of the header tagged passage to something like:
    {
    (print: "<script>$('html').removeClass('desert')</script>")
    (if: $someVariable)[
    (print: "<script>$('html').addClass('desert')</script>")
    ]
    }
    
    ... don't forget to assign the variable a default value within your startup tagged passage.

    b. Otherwise is you want the colour change to occur for the same Passage that the variable is changed in then you need to replace the header tagged passage with a footer tagged passage containing the above code.
  • Thank you so much :D
Sign In or Register to comment.