Open naiming-zededa opened 7 months ago
How does the code myApp.CurrentShemeDark
fit in? This is not part of the exported APIs...
Ok, sure. But I see this in the code:
darkScheme := map[string]colorInfo{}
lightScheme := map[string]colorInfo{}
I'm just not sure how to invoke 'dark' or 'light' in this scheme with APIs.
Most themes don't offer any variant setting, and the adwaita is the same.
But you can create a new theme that wraps this one and specify the variant
instead to override the system settings...
fyneApp.Settings().SetTheme(theme.DarkTheme()) myApp.App = fyneApp myApp.CurrentShemeDark = true
This code seems to work only if the system setting is in 'dark' mode.
I have just realised this code doesn't mention Adwaita at all - maybe it was a bad paste?
I have just realised this code doesn't mention Adwaita at all - maybe it was a bad paste?
Sorry, you are right. I used to do this:
fyneApp.Settings().SetTheme(theme.AdwaitaTheme())
myApp.App = fyneApp
myApp.CurrentShemeDark = true
this works fine. until I changed system mode to 'light'
You are pasting custom code but not explaining how it works. The theme you are using adapts to the OS setting - why do you expect that those lines of code will change that?
maybe i misunderstood the AdwaitaTheme, i thought it could be integrated into the fyne theme. but how does it suppose to change between 'darkScheme' and 'lightScheme'?
All fyne themes reflect the OS user preference for light/dark, is this not what you are seeing?
To force one variant you could wrap the theme and force your variant
choice into the Color
function call.
what i'm seeing is this, it i do: fyneApp.Settings().SetTheme(theme.DarkTheme()) or fyneApp.Settings().SetTheme(theme.LightTheme())
it works, regardless of the host system mode setting
but if i'm changing to: fyneApp.Settings().SetTheme(theme.AdwaitaTheme()) or fyneApp.Settings().SetTheme(theme.LightTheme())
what i'm seeing is that, if the host system is in dark mode, it works fine. I can change to the 1st one, get the dark mode, and to the 2nd, get the light mode. but if the host system is in light mode, even i set to the 1st one, it's still in light mode.
what i'm seeing is this, it i do: fyneApp.Settings().SetTheme(theme.DarkTheme()) or fyneApp.Settings().SetTheme(theme.LightTheme())
it works, regardless of the host system mode setting
These are deprecated because it ignores the user preference which is not what we want to see happen.
but if the host system is in light mode, even i set to the 1st one, it's still in light mode.
Isn't that correct? the theme is matching the user setting. When you call SetTheme
a second time it will completely replace the theme, so what you set before has no impact on the theme you load second.
but I would think more specific should always overwrite the less specific. If my app has a button to turn it to 'dark' mode, then regardless of the global setting, it should be dark. This is more specific user preference.
Ok, and how have you coded it so that preference overrides the system default?
This code seems to work only if the system setting is in 'dark' mode.