Skip to content

Instantly share code, notes, and snippets.

@wesdeveloper
Created March 3, 2018 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesdeveloper/932bc42dc5f6863187c3727792dae4d8 to your computer and use it in GitHub Desktop.
Save wesdeveloper/932bc42dc5f6863187c3727792dae4d8 to your computer and use it in GitHub Desktop.
const channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
const colorsListItem = ["--yellow", "--coral", "--purple"];
// Showing channel names and adding colored item
for(i=0;i<channels.length;i++){
// Creating random value for item color
function randomColor(){
number = Math.floor(Math.random()*colorsListItem.length);
color = colorsListItem[number];
return color ;
};
const color = randomColor();
$('#list').append(
'<li class="listItem" style="background-color:var('+ color +')"><p>' +channels[i]+ '</p></li>'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment