Change color of the result of a PING

Good evening, I would like to know if there is any way to change the color of the terminal in Linux when the result of a ping is “Host destination inaccessible” otherwise keep the default value. I tried to think about how to do it but I’m not good at the linux command line.

No, it is not possible. Have you tried, mtr?

mtr www.cyberciti.biz
mtr --displaymode 1 google.com
mtr --displaymode 2 IP_ADDRESS_HERE

You can install mtr on Ubuntu using apt-get/apt command:

sudo apt install mtr