Well
Now I have the Mac set with light mode
After deleting the cache I enter the address of the page in Safari and the result is correctly in light mode
But the image and text of the variable are those of the Dark mode
If I choose (with the swicht) the dark mode the page is the dark one and it remains even later (image and variable text ok)
If I choose the light mode (with the swicht) the page is correctly light, the image is correct, but the variable is incorrect
If I choose the automatic mode, the page is light but incorrect variable image and text
In practice, the variable does not change
Now check your suggestion
Well, the variable is always calculated from the javascript functionā¦
You can ignore the value of variable in case that the theme is dark or lightā¦
Then, the picture is defined in the conditional regions.
It check which theme from the three (light/dark/auto) is selected and it renders the correct picture.
And of course only one condition can be treu and one picture will be rendered
always empty variable, if it is not attributed by default:
-Light mode -> view and image ok
-Dark mode -> View and image ok
-Automatic mode -> OK View but no image
But I think that if the variable is always nothing, it is difficult to work
Iām sure because it works for meā¦
I think that by making all these changes, somewhere you have a wrong code or left a piece of code that doesnāt workā¦
So, now that you know what we need to do, I suggest you to start a new (test) page and bind the correct elements through the UI to be sure that the code of your page is correct
And when you copy/paste code just make sure it is correct
I did not manage to make the code work correctly.
Maybe it doesnāt work with different browsers and operating systems
Therefore at the moment I give us up
I have therefore been looking for another way, apparently much simpler, but with a defect to correct.
After eliminating any reference from the page, I inserted the following code as an image:
You mean that it works on browser but not inside wappler?
Or you mean that a user cannot change the theme on the browser by the theme switch?
If the second is happening maybe we can fix it by setting the current (selected) theme in a variable and use the variableās value for the pictureās source
With this solution, the procedure is completely different.
In practice, even with the page in use, if you change the setting of the theme on the device, the images are automatically displayed.
1 case Dark device set
Dark Image Correct
Automatic Image Correct
Light image not correct
2 Light device set set
Light Image correct
Automatic Image Correct
Dark image not correct
The automatic mode is always correct
The problem that remains is that the images do not change correctly when changing selection with Wapplerās switch
Thanks George
If I understood well then, do I just have to create two different images and condition their visibility with two condition regions that compare the status of the Theme Manager?
I already mention that but @Marzio needs to find a solution for the case of āautoā themeā¦
In this case he is trying to get the userās device prefers-color-scheme so he can assign the according pictureā¦
I see that the theme manager data settings indeed stays on āautoā when the auto mode is on and doesnāt reflect the current selection. @patrick should fix this.