Protection and the biology of the animal.
When in a state of 'less awareness' or 'rest', they lighten to blend. A lot of fish will also pale with sickness or distress (like a predator, or when being shipped).
When fish rest, the blood is circulated less to the outter regions of the body, instead focusing on the internal organs and systems needed to keep them alive. Shutting down like that allows them to rest without being fully asleep like mammals do. Less circulation is reflected in the loss of color. In pacu, you see them pale. In brightly colored fish like cichlids or saltwater reef fish, their amazing reds, blues and yellows fade to much lighter tones.