Get switch position from a different screen

Hello,
I'm trying to make an app in which the user can select between a dark and light mode in the main menu and I'm trying to find a way for the program to figure that out and change the next screen's background colour. Haven't found anything and don't even know if it is possible but any help is appreciated.

Save the switch setting to the tinydb, then call back this setting in your other screen. You will need to set the switch setting each time you return to the screen with the switch on it as well.

I'm trying to get the tiny db to store the tag as either DMT (dark mode true) or DMF (dark mode false) with the value being true or false but the colour always sets to black for some reason.
image_2023-10-10_163247379

Something like this for the switch setting screen (not tested)

I tried what you have there and it worked! thank you very much.

after further testing, it has stopped working somehow, I've had problems with the device I'm using for testing displaying white or black but I've changed the colors and it's still not working


image

When does it stop working ?

all the time. when i initially tried it it worked but after testing it to make sure everything worked it stopped working. I've tried reconnecting the companion as well as undoing any previous changes but nothing seems to fix it. can the tiny DB get full or something similar?

Try this

(small error on my part....)

Do i put the "to change" on both screens? it doesn't let me call change on a second screen

I generally use a “Settings” screen in my apps. Among other things, it is also possible to switch between a light or dark design. In order for this setting to also take effect on Screen1, Screen1 must be reinitialized as soon as this screen is switched to.

Here are my simplified blocks for Screen1 and Settings:
darkLightDesign.aia (4.5 KB)
It should work with Companion & the APK.

Screen1:

Settings:

Screen1 Blocks

Screen2 Blocks

image

This worked. thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.