Hi guys,
I was wondering wether it is possible to create a button called 'dark_mode' and when clicking the button the whole main background will turn into a black color theme?
Best regards and thanks in advance
Hi guys,
I was wondering wether it is possible to create a button called 'dark_mode' and when clicking the button the whole main background will turn into a black color theme?
Best regards and thanks in advance
Maybe there is a better way, but I'd just use a temporary state. Have the button update the temporary state when clicked, and based on that state set the background color.
Here is a demo app:
dark-mode-test.json (6.1 KB)
I imagine it would become a pain to update all of the various components colors. I'm currently on the "Team" plan, so I don't have access to the theme stuff that comes with the "Business" plan. Might be easier with that
Access the mode from within an app using theme.setMode(āmodeNameā, persist: true)
. This method makes it easy to change modes based on user interactionāfor example, you can create a Switch component that toggles between light and dark mode. The persist
parameter maintains the mode selection for a user's subsequent sessions.