I am looking to create a set of buttons representing the colors ROYGBV. I want to use JavaScript to apply a function that will change the background color when each button is clicked. The current code I have seems too lengthy. Can someone assist me with this?
function redColor(){document.body.style.backgroundColor="red";}
function orangeColor(){document.body.style.backgroundColor="orange";}
function yellowColor(){document.body.style.backgroundColor="yellow";}
function greenColor(){document.body.style.backgroundColor="limegreen";}
function blueColor(){document.body.style.backgroundColor="blue";}
function indigoColor(){document.body.style.backgroundColor="#4B0082";}
function violetColor(){document.body.style.backgroundColor="violet";}