'chrome extension - how to keep dark mode function running even when the page is reload the url changed

i am trying to make a dark mode extension and i made a function turning the page in dark theme and it works fine but when i reload the page or change the URL or the tab the function stop working



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source