Icons color need to change based on network

HI Guys im new to ionic …
Is there is any way to change ionic icons color based on Network Connectivity
for ex:
Icon need to turn on green color if its connects to internet, if its no network it need to turn red.

Thanks in Advance