Dark mode on Xamarin
Dark mode darkens background colours and provides a more comfortable viewing experience in low light. This is essential for many visually impaired people since a light background colour can be painful or even impossible to look at for an extended period of time. But also people who have problems with their concentration, for example due to a brain disorder, benefit greatly from dark mode.
Met Xamarin weet je dat donkere modus geactiveerd is wanneer RequestedTheme
eigenschap ingesteld is op OSAppTheme.Dark
.
Binnen XAML
kun je gebruik maken van AppThemeBinding
om donkere modus varianten in te stellen.
using Xamarin.Essentials;
OSAppTheme theme = Application.Current.RequestedTheme;
if (theme == OSAppTheme.Dark) {
// Dark mode
}