Formula to change icon image?

I could do with some help on a formula, if someone could kindly oblige.

A want to create a (toggle) widget that will turn wifi/gps on/off. Therefore, I'd need some sort of formula that gets the wifi/gps state and changes the icon for certain states.

Is that clear?

Thanks in advance.

Yes, you can do this with images (there is a tutorial HERE this shows how to switch between day / night but you can use the same for wifi on/off using $if(nc(wifi) = CONNECTED, 0, 100)$, you can do the same with font icons and instead of changing the opacity you cange the color.

$if(nc(wifi)=DISABLED, Signal_wifi_off,nc(wifi)=ENABLED,Signal_wifi_4_bar,nc(wifi)=CONNECTED,Wifi)$

When you create an icon use the Material icon set, and enter this formula where you would choose the icon. Then on the Icon touch setting, use Kustom Action and set mode to toggle wifi.

When you push the icon it will enable and disable wifi and will show a different icon for each state.

$if(nc(bt)=0,Bluetooth_disabled,nc(bt)=1, Bluetooth,nc(bt)=2,Bluetooth_connected)$

Use the second formula for Bluetooth the exact same way as you did for wifi.