✅ Light mode /dark mode for my avalonia Project
Hey there, I just wanted to ask: what is the simplest method to find out if a user has light or dark mode enabled, based on that i would implement it so I can change my avalonia theme.
8 Replies
btw. i haven´t really figured out what to do - i looked in many posts of stack overflow - but i couldn´t find a solution
havent tried it
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-windows-themes
Support Dark and Light themes in Win32 apps - Windows apps
Learn how to detect system theme changes for dark or light mode.
Sadly it’s C++ and not Avalonia C# 😦
you mean on their system?
youd have to use the platform specific api
https://github.com/AvaloniaUI/Avalonia/discussions/18002
could try this
GitHub
How to detect light or dark colour mode · AvaloniaUI Avalonia · D...
How can a desktop application that uses a light/dark colour mode-sensitive Fluent theme find out the operating system's colour mode? Usage example. I want to colour-code the text in each data r...
I mean my problem is currently only windows, but if it is cross platform it would be even better. Wait - the link you sent me is a bit confusing. Could you tell me how they know if it’s dark or light mode via code?
check if
Application.RequestedThemeVariant or Application.ActualThemeVariant work
if not try #guiAlright I will try in a few minutes
I will ask in gui, thank you for your help 🙂
that worked 🙂