css :focus

CSS
/*Changing the color the red when it starts*/
body{
  background-color: red;
}

/*Changing the color to blue when you focus on the window*/
body:focus{
  background-color: blue;
}
Source

Also in CSS: