I wanted to use Google Chrome's feature called theme-color. The normal syntax looks like this:
<meta name="theme-color" content="#c12432">
However i want to use 3 different colors so I came up with this code. It's worth metioning that I don't have experience with JavaScript so please tell me what's wrong with the code. What i want to do is that it ramdomly chooses a number and with that number it changes the content="value" with the ones specified below.
function colorchanger() {
var x = Math.floor((Math.random() * 3) + 1);
if (x >= 3) {
document.getElementByName("theme-color").content = "#c12432";
}
if (x = 2) {
document.getElementByName("theme-color").content = "#338fc4";
}
if (x = 1) {
document.getElementByName("theme-color").content = "#d99e33";
}
}