-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Run] Sync accent color #4107
Comments
@AnuthaDev One thing I am worried about the solution in #2988 is that we would be unnecessarily checking for accent changes each time launcher is visible, impacting startup time. That's why we want to stick strictly to a callback-based solution. Your solution does give a neat way to find accent colors and it would be helpful if you could integrate this into our ThemeManager. |
@somil55 Yeah, I was thinking about it too, I will work on it tomorrow |
Hey @somil55 I found this wouldn't it be better if we add theming support this way instead of adding another dependency, its roughly the same work... |
@AnuthaDev I have handled high contrast modes in the same way and used controlzex to receive a callback on dark/light windows theme change. One thing you can do is to look at Controlzex |
@somil55 If we use this, we don't need to callback from the registry |
The uicolortype background color is black in dark mode and white in light mode |
The same event handler can process theme change as well as accent color change |
@AnuthaDev I just tried to use UISettings and the callbacks don't fire for me. UISetting is probably only for UWP apps. Have you tried using it? Another issue is that if we use UISetting we would have to manually handle changing resource dictionary at runtime. Currently, we have all of it nicely packed in controlzex library. |
I haven't tested the callbacks yet... But accessing the theme via uicolortype.background works for me... |
Yeah, fair point I guess. I'll see if any better approach can be used |
Apparently, windows has a bajilion ways of doing the same thing |
I would currently suggest you look at |
@somil55 said:
So, I copied and enhanced it in #4134😁 Also,
Bet they can't beat this sneaky boi😁 |
I might be missing something but what is that you are doing differently from their implementation?
You would need to handle a generic case for location of your resource. |
Not much really, but Its less code than adding a dependency
Please elaborate |
Currently, you are using
In the above example a language resource has been added So you would need to figure out a way to identify at which index in Merged dictionary is your resource located (if any) and then overwrite it. |
I wouldn't be against adding a dependency. I personally find it better to leverage existing work rather than reinventing the wheel. |
I believe I solved it |
Yeah, well this dependency also has a lot of bloat that is not required, also the "reinventing the wheel" part of #4134 is still smaller than using this library... |
For accent color for PowerToys may be something we want at a global level, not just PT Run. Which then implies that would be a C++ library as FancyZones and other apps may want it. |
@crutkas Thanks for replying:
My PR supports all modes :)
Yeah, I was getting build errors, that is why I did it. The PR is still in draft though and I will revert the changes :)
Yeah, that makes sense. I say, lets keep it localized to PT Run for a release and then work on making it a c++ library. |
@somil55 shouldn't this be easy now we've migrated to ControlzEx? |
@crutkas Controlzex has added functionality to invoke a callback on accent change. So I am guessing this should be a straightforward feature to implement. |
@somil55 @crutkas For #6899 I used ModernWPF.. It has a {DynamicResource SystemAccentColor} that updates automatically when the Windows accent color is changed. Works really well. It also has darker/light accent brushes (like UWP) that might be useful for e.g. the focus color. Might be something for Run? |
@niels9001 This seems like a clean fix for adding accent colors. Though one catch here might be dealing with accent colors in high contrast modes. @crutkas Any thoughts on this? |
@somil55 I think Windows defaults back to back or white for the Accent color, right? I guess this is to not conflict with actual high contrast colors. For the focus color, we could could use the primary high contrast color (e.g. purple, green, turquoise? |
@niels9001 On a quick pass in high contrast mode, it seems like accent color is being set to black/white. And your idea for using primary high contrast color sounds good. |
Would love if a community member could help on this. |
@crutkas Can we use ModernWPF? It's MIT licensed and allows for seamless accent color syncing. Additionally we can use those styles instead of the ones we've made (e.g. for the scrollbar). Using it for ColorPicker as well. |
Powertoys run accent color should change on changing windows accent color
The text was updated successfully, but these errors were encountered: