NovichokJS,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
ul {
list-style: none;
width: 240px;
}
.list__item_done {
background-image: -webkit-linear-gradient(left, #0000CD, #FF0000);
background-image: linear-gradient(to right, #0000CD, #FF0000);
color: #FFFFFF;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
const chbx = document.querySelector('.list');
const lis = chbx.querySelectorAll('.list__item');
chbx.addEventListener('click', () => {
for (let i = 0; i < lis.length; i++) {
let li = lis[i];
if (li.querySelector(":checked")) {
li.classList.add('list__item_done');
} else {
li.classList.remove('list__item_done');
}
}
});
})
</script>
</head>
<body>
<ul class="list">
<li class="list__item"><input type="checkbox" class="list__item-checkbox">Buy milk</li>
<li class="list__item"><input type="checkbox" class="list__item-checkbox">Pick up Tom from airport</li>
<li class="list__item"><input type="checkbox" class="list__item-checkbox">Visit party</li>
</ul>
</body>
</html>