C
C#4mo ago
Daiko Games

✅ 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
Daiko Games
Daiko GamesOP4mo ago
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
Daiko Games
Daiko GamesOP4mo ago
Sadly it’s C++ and not Avalonia C# 😦
sibber
sibber4mo ago
you mean on their system? youd have to use the platform specific api
sibber
sibber4mo ago
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...
Daiko Games
Daiko GamesOP4mo ago
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?
sibber
sibber4mo ago
check if Application.RequestedThemeVariant or Application.ActualThemeVariant work if not try #gui
Daiko Games
Daiko GamesOP4mo ago
Alright I will try in a few minutes I will ask in gui, thank you for your help 🙂 that worked 🙂

Did you find this page helpful?