Color Palette Generator

Easy
26
2
69.8% Acceptance

In this lab, your task to is to create JavaScript Functions, to make the Color Pallete Generator functional. The required Markup and the Styling has already been written for you. You can take look at them to understand how the styles are being applied.

Challenge

Your task is to create 5 Div's with .color-block class when clicking on the #generate button (already written for you).

To achieve this, you will need to do the following:

  1. Create the generateRandomHexCode() function, which will always return a valid color hexCode of the format #xxxxxx
  2. Create the generateColorPalette() function to create 5 div's with color-block class and set the following properties
    • background-color style to the generated random hex code from generateRandomHexCode()
    • data-color attribute to the same hexcode (for showing the hex code on hover over the color block) .

All the best!