qusaze,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.night {
background-color: #000000;
color: #FFFFFF;
}
</style>
</head>
<body>
<p>test</p>
<input name="" type="button" value="click me" class="block">
<script>
let html = document.querySelector('html');
if (localStorage.getItem('night') == 'true') {
html.classList.add("night");
}
document.querySelector('.block').addEventListener('click',function() {
html.classList.toggle("night");
localStorage.setItem('night', html.classList.contains('night'));
});
</script>
</body>
</html>