you can achieve this using jquery if you don't need to save the color in database
There is a setInterval function in javascript which runs after every specified second.
you can make use of that function in following order
to know about setInterval
javascript - Looping through list items with jquery - Stack Overflowto loop through list view and get the values
<script>
setInterval(function(){ alert("Hello"); }, 2000);
function changeRowColor(){
}
<script>