Howdy, Stranger!

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

How To Change The Background To Different Colours

I know how to use (background:), but that just draws a box around the text. And I know how to change the overall background colour using the Stylesheet. However, I do not know how to make background colours different.

Also, I don't really know how to use tags, so if I need to use them please tell me how.

Comments

  • Also, I am using Harlowe.
  • Don't worry; I've figured it out.
  • Actually, no, I haven't figured it out.
  • Sorry, I have.
  • Alright, how did you do it? Just for others' reference. (also mine :smiley:)
  • The Basic Harlowe Passage Tag Based Styling thread explains one way to do what you want, it also contains an example of the CSS needed to change the background-color of a story's html element which is where Harlowe defines the default background colour.
  • Alright, how did you do it? Just for others' reference. (also mine :smiley:)

    What you do is you plan out your story, and what passages will have what background. So, if you have a story with the arctic, the desert and the jungle, you would want different background colours. Go into the styelsheet and do this code:
    html.arctic {
          background-color: blue;
    }
    
    html.desert {
          background-color: orange;
    }
    
    html.jungle {
          background-color: green;
    }
    

    This is saying that anything tagged arctic will have a blue background colour, and same for the desert and jungle. Then, go into whichever passage. For example, I'll go into the arctic passage. Create a new tag and call it arctic. You can call the tag whatever you want, but it has to be the same as what you wrote in the stylesheet. Then, copy and paste this into the first passage of the arctic:
    {
    (print: "<script>$('html').removeClass(\)</script>")
    (if: (passage:)'s tags's length > 0)[
    (print: "<script>$('html').addClass('" + (passage:)'s tags.join(' ') + "'\)</script>")
    ]
    }
    

    Once you have done that, all the next passages will be blue until you get to a different place, like the jungle or the desert. It's kinda complicated, so let me know if you don't understand it.
Sign In or Register to comment.