Themeing my App for different screens

Hi!
I made a small App with a few different screens.
Currently I am trying to write a setting that makes an app wide theme change.
For that I try to store colours into a list and call that colours on each screen. It wont work though. Can you give me a few pointers please?

Thank you for your help in advance! :slight_smile:

In the setuptheme procedure, I hope you have added blocks wrongly. In the set component place you have added tinydb , I hope it is having buttons list, in such case you must use for each items in the list (get call tinydb) set any button color component (get item) color (add colour)

Hi! I really appreciate your answer, but I dont quite understand it.
My thought process was: I store a list into tiny db called AppTheme which consists of 3 colours.
I also store a list called ListOfButtons that consists of all the buttons.
I then call the procedure and try to change the colours with the indexes from the AppTheme list.

I still havent managed to make it work :frowning:

Try like this:

simpleTheme.aia (3.6 KB)

Thank you! I think I learned lots of stuff with it! I still have problems getting it to work correctly though.
I want my settings bundled on another screen. I still dont really get how to transfer my settings form one screen to another.

Do you want to set the theme only on one screen, or be able to set the theme on any screen ?

I want to change the theme only on the settings screen.
The chosen theme should affect every screen.
Default theme should be the light one.

I managed to sometimes get it toi change color on different screens but still no real working solution. :frowning:

Is there anyone that has a clue where I'm going wrong?

What is the problem? You say you can get it to work - sometimes, but just telling us does not help.

You need to show your blocks for the setting of your "theme", and then show your blocks for how you are trying to set the "theme" on a different screen.

the Blocks are the same as pictured above. One picture is the settings screen, the other picture screen1. Wildly clicking the switch and changing screens makes it change colour. So it seems the blocks are doing something. But not consistently and always.

OK, I reworked my previous aia to include a second screen, that adopts the "theme" set in Screen1.

simpleTheme2Screens.aia (5.9 KB)

You will need similar blocks in each screen you create.

I have assumed here that you will go back to Screen1 from Screen2, given that you came from Screen1.

With more screens, you may need to manage your screen switching correctly:

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)
 
Also see demo: multiscreen.aia
 

thank you for that answer! I will reply if i get it working! :slight_smile:

Another question since you mentioned muiltiple screens.
The method I'm currently using shouldnt run into memory trobles, since it closes the screen its coming from, correct?

You may find it will not work with companion, but will work when the app is compiled

You could also try this:

image

or this

image

Hi!
Thank you so much for your help so far!
Sticking closely to your SampleProject I managed to get it to change color on SettingsScreen.
I intend to have it the other way around. (Settings on Screen2, Screen1 is a home screen.)

A few problems I now have:
It won't change anything on Screen1 regardless of what I set it to on SettingsScreen.
Also, the Switch will always show grey TextColor which shouldn't be the case.

I think I understand what each block does. The change I did was storing the colors in screen1 instead of the screen the actual change of settings commences.

You should make sure, using my project as a guide, that you have all of Screen1's blocks and components (my app) on Screen2 (your app), and all of Screen2's blocks and components (my app) on Screen1 (your app)

I'm pretty sure I did that. I've been staring at it for an hour now, but I cant find the error. :frowning:

Share your AIA project, so others can take a look

It's up there, the blocks are all in the pictures :slight_smile:

I tried adding the block that stores colors to the settingsscreen and tried changing the color of a label.
Both to no avail.
I think the error is on screen1 the If question. It always uses the valueiftagnotthere field.