Put the element "Theme catcher" from the "Visual elements" menu directly wherever you want into your main page. Now you can get the dark theme status directly form the element or use the "theme catched" event to do something like save the status into the user database.
Before trying the plugin in your app you can learn more about it by visiting the following pages:
SANDBOX:https://24c6f019b2dc67cbb92bf6c24e174cf4.bubbleapps.io/version-test/b957c02aFORUM:https://forum.bubble.io/t/how-to-change-automatically-the-theme-of-your-app/228730