British saying to express great surprise and or fear.
the use of the words "blue lights" in this saying most likely refers to the lights found on emergency vehicles such as police, ambulance and fire service.
When they approach from behind at breakneck speed with their sirens blaring and lights flashing, you are often caught by surprise, this causes the fight of flight response also known as "shitting yourself. "
The combination of flashing lights as well as a fear response produces the saying "shitting blue lights"
There was a loud bang followed by a scream, i shat blue lights, and ran
When i saw the dog come running out the gate after me, i was so scared i was shitting blue lights.
Note* emergency vehicles do not need to be present for this saying to be used to describe acute fear or surprise.