JSFiddle - React, Tailwind, and code Playground

HTML

<button id="cmdTest">
Test
</button>
<span id="text">This is a text</span>

CSS

span#text{
  color: yellow;
  background-color: orange;
}

.contrast-high{
  color: green !important;
  background-color: black !important;
}

JavaScript

$('#cmdTest').click(function(){
	localStorage.setItem("contrast", "contrast-high");
});

$(document).ready(function(){
	var css = localStorage.getItem("contrast");
  console.log(css);
  $('#text').addClass(css);
});