I want to benefit from light/dark mode auto switch on as many apps as I can, including my terminal emulator (iTerm2), my favorite shell's (fish) and neovim.
Why light mode do you ask? Well, because when I work in a brightly lit room, a dark terminal strains my eyes. That's also why you'll likely find me using light mode on my IDE during the day (yes, my colleagues often complain about that during video conference, no I don't apologize).
update_nvim_theme lists all running instances of neovim and sends a command to update the background color (light or dark). neovim then reacts accordingly and uses an appropriate color scheme.
The script and functions presented here are a more advanced version of an answer I posted on SuperUser stack exchange recently. I'd like to thank NotTheDr01ds, who posted the first answer to this question. It led me in the right way.