I'm currently dealing with a website that generates a random background color for a div every time it is refreshed. I have a code that successfully accomplishes this:
var colorList = ['#FFFFFF', '#000000', '#298ACC', '#B079E0'];
$(function() {
$('#color-change').css({
background: colorList[Math.floor(Math.random()*colorList.length)]
color: colorList[Math.floor(Math.random()*colorList.length)]
});
});
My issue now is that I want the text color to match the background color, but the current code changes both randomly. How can I modify it so that only the background color changes randomly and the text color simply reflects the current background color?