AppTheme bindings For Dark/light modes #143
-
What would be the best way to setup the styles to implement Dark/light mode. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are multiple options.
Those options have their difficulties, so I'll try to create a sample demonstrating them soonish . |
Beta Was this translation helpful? Give feedback.
There are multiple options.
Set style directly in razor (e.g. AppTheme.Light ? Colors.White : Colors.Black). Not really pretty, but might work for the simplest apps.
Build a resource dictionary with C#, and apply it to your application globally or per control.
Build the same resource dictionary with XAML. I don't really like xaml for layout trees (hence this project), but for styles only - why not.
You can also use css stylesheet, but I don't advise it - it's quite limited, and not really supported by MAUI devs anymore.
Those options have their difficulties, so I'll try to create a sample demonstrating them soonish .