For now I have that when key is down it changes colours, and as soon as it is up it changes back. But this is really quick and kinda causes migraine effect.
I want to do so when the key is pressed it would keep the changes for a second or two and then changes back to original colours without pausing any other function that is not inside these ones.
$(window).on('keydown', function (e) {
    if (e.keyCode == 39 || e.keyCode == 32) {
      $('body').css('background', '#26A65B');
      $('#word').css('color', '#415A77');
    }
    if(e.keyCode == 37) {
      $('body').css('background', '#D64541');
      $('#word').css('color', '#415A77');
    }
  });
$(window).on ('keyup', function (e) {
    if (e.keyCode == 39 || e.keyCode == 32 || e.keyCode == 37) {
      $('body').css('background', '#415A77');
      $('#word').css('color', '#ed7d3a');
    }
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
     
     
    