Shade Shuffle is a fun beginner-friendly JavaScript project that changes the background color of the webpage every time you click a button.
This project is designed as a practice exercise for learning HTML, CSS, and JavaScript.
In this version, the main logic has been removed, so you can write it yourself using the provided comments and hints.
You can see the completed sample site here: https://addison-haight.github.io/ShadeShuffle/
shade-shuffle/ โ โโโ index.html # Basic page structure โโโ style.css # Styling for the page and button โโโ script.js # JavaScript logic (with TODOs for students) โโโ README.md # Project documentation
By completing this project, youโll practice:
- Selecting and manipulating HTML elements using JavaScript DOM methods
- Generating random colors using JavaScript logic
- Handling button click events
- Updating text and styles dynamically
- Writing clean, commented code
- Open
script.js - Implement the following:
- A function to generate a random hex color code (e.g.,
#A1B2C3) - Logic to:
- Change the background color
- Display the new color code inside the
<span>element
- A function to generate a random hex color code (e.g.,
- Test your logic by clicking the Shuffle Shade button.
- Customize styles in
style.css(optional).
- Use
Math.random()andMath.floor()to generate random numbers. - A hex color is made up of 6 characters (0โ9, AโF) after the
#.