JSFiddle - React, Tailwind, and code Playground
HTML
<textarea type="textarea" class="formArea" name="output" onclick="this.focus();this.select()"
id="output" cols="70" rows="10" placeholder="Some text"></textarea>
<br>
<div class="btn-group">
<button value="Combine" class="buttonGroup" onclick="convert()" id="combine1">
Button
</button><br><br>
</div>
<br>
<textarea type="textarea" class="formArea" name="output" onclick="this.focus();this.select()"
id="output" cols="70" rows="5" placeholder="Some text"></textarea>
<br>
<div class="btn-group">
<button value="Combine" class="buttonGroup" onclick="convert()" id="combine1">
Button
</button><br><br>
</div>
<br>
<ul id="switcher">
<li id="blackButton">
CSS
body {
background-color: #ec7c23;
}
.btn-group button {
background-color: #577CC1;
border: 1px #577CC1;
color: white;
padding: 10px 24px;
cursor: pointer;
float: left;
font-weight: bold;
}
.btn-group:after {
content: "";
clear: both;
display: table;
}
.btn-group button:not(:last-child) {
border-right: none;
}
.btn-group button:hover {
background-color: #2C3E60;
}
textarea[type="textarea"] {
width: ;
padding: 5px 10px;
margin: 5px 0;
box-sizing: border-box;
font-family: arial;
font-weight: bold;
border: 10px;
background-color: #F4F6FA;
color: darkblue;
border: 4px solid #577CC1;
border-radius: 4px;
}
textarea[type="textarea"]:focus {
border: 4px solid #e66026;
}
h1 {
line-height: 1.25;
margin: 2em 0 0;
}
p {
margin: .5em 0;
}
#switcher {
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
}
#switcher li {
float: left;
width: 30px;
height: 30px;
margin: 0 15px 15px 0;
border-radius: 30px;
border: 3px solid black;
}
#blackButton {
background: red;
}
JavaScript
document.getElementById('blackButton').onclick = switchBlack;
function switchBlack() {
var body = document.getElementsByTagName('body')
for(var i = 0; i < body.length; i++) {
body[i].style.color = 'white';
body[i].style.backgroundColor = "grey";
body[i].style.fontFamily = 'terminal';
}
var formArea = document.getElementsByClassName('formArea')
for(var i = 0; i < formArea.length; i++) {
formArea[i].style.backgroundColor = 'black';
formArea[i].style.borderColor = 'white';
formArea[i].style.color = 'white';
formArea[i].style.fontFamily = 'terminal';
}
var css = '.btn-group button {background-color: purple; color:black; border-color: white; font- family: terminal; font-weight: bold; border-radius: 0px;}';
var style = document.createElement('style');
if (style.styleSheet) {
style.styleSheet.cssText = css;}
else {
style.appendChild(document.createTextNode(css));
}
document.getElementsByTagName('head')[0].appendChild(style);
var css = '.btn-group button:hover {background-color: red; color: white;}';
var style = document.createElement('style');
if (style.styleSheet) {
style.styleSheet.cssText = css;}
else {
style.appendChild(document.createTextNode(css));
}
document.getElementsByTagName('head')[0].appendChild(style);
}