When the last command in an interactive bash instance is done, the evaluated PS1 variable is displayes. Before actually displaying PS1 bash looks whether the PROMPT_COMMAND is set. This value of this var must be a callable program or script. If this var is set this program/script is called BEFORE the PS1 prompt is displayed.
# just a stupid function, we will use to demonstrate
# we check the date if Hour is 12 and Minute is lower than 59
lunchbreak(){
if (( $(date +%H) == 12 && $(date +%M) < 59 )); then
# and print colored \033[ starts the escape sequence
# 5; is blinking attribute
# 2; means bold
# 31 says red
printf "\033[5;1;31mmind the lunch break\033[0m\n";
else
printf "\033[33mstill working...\033[0m\n";
fi;
}
# activating it
export PROMPT_COMMAND=lunchbreak