Howdy, Stranger!

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

How To make an option to change backround colour

Please help i wnat to make setting for my game and i want people to be able to have a couple of selection of colour how do i make it so people can click a button and it will make the backround colour and text change colour?

ps. I use halowe 1.2.2

Comments

  • You can use CSS and a little Javascript to change the theme of your story.

    1. Define the themes using CSS class based selectors.

    The following defines two very basic themes (desert and forest) which alter the default background colour of the story, these could be extended to change other properties as well. The CSS goes within your story's Story Stylesheet area.
    html.desert {
    	background-color: Beige;
    }
    
    html.forest {
    	background-color: LightGreen;
    }
    

    2. Use a little Javascript to set the theme by assigning a CSS class to the body element.

    The following shows how to jQuery's removeClass() function and it's addClass() function to remove all or add a single CSS class to the story's body element.
    (link-repeat: "Desert")[<script>$('html').removeClass().addClass('desert');</script>]
    
    (link-repeat: "Forest")[<script>$('html').removeClass().addClass('forest');</script>]
    
    (link-repeat: "Default")[<script>$('html').removeClass();</script>]
    
Sign In or Register to comment.