Detect the state of the wifi

I would like to change the background depending on the state of the wifi :

if (//wifi is activated\\) {
 } else {

What should we put in place of “//wifi is activated\” ?
Do you have an idea to solve my problem ?
Thank you.

Whether your computer has wifi on or not is OS-level information. How to check will depend on if you are on Windows, MacOS, or Linux.

For example, on Windows, you could use command to check ipconfig or ping.

On MacOS, you could try a command to ping or netstat.

Or, if you have a particular server you are connecting to in your sketch, just test its availability directly with the network library using available().