Skip to content

Instantly share code, notes, and snippets.

@adueppen
Created June 4, 2017 16:40
Show Gist options
  • Save adueppen/e36b2b0bc8f5d4eefd2a2b7815fe80f6 to your computer and use it in GitHub Desktop.
Save adueppen/e36b2b0bc8f5d4eefd2a2b7815fe80f6 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no">
<meta charset="UTF-8">
<meta name="theme-color" content="">
<title>Can meta theme-color be changed?</title>
<!--<script type="text/javascript" src="js/randomColor.js"></script>-->
</head>
<body style="font-family: sans-serif;">
<span style="white-space: nowrap;">
<label for="change-color">Change <code>theme-color</code>:</label>
<input type="color" value="#ffffff" id="change-color" onchange="changeColor()"/>
</span>
<script type="text/javascript">
//setInterval(changeColor, 1000);
function changeColor() {
//var color = randomColor();
var color = document.getElementById('change-color').value;
document.querySelector('meta[name="theme-color"]').setAttribute("content", color);
document.body.style.background = color;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment