Flat Accent: A theme that follows the windows theme color#731
Flat Accent: A theme that follows the windows theme color#731dremin merged 8 commits intocairoshell:masterfrom
Conversation
|
Nice! I'd like to get this merged with some improvements:
Honestly, this should probably be the default Flat theme; we could append 'Blue' or something similar to the current theme's name. We should also move much of the accent color code into ManagedShell so that other shells can benefit. |
|
Checking for changes can be done through SystemEvents.UserPreferenceChanged. |
|
By using power toys and checking registry values Also another thing |
Fallback to Flat theme's blue accent for windows versions <8
Cairo Desktop/Cairo Desktop/Services/CairoApplicationThemeService.cs
Outdated
Show resolved
Hide resolved
[*] Changed the behavior of the UserPreferenceChanged event:
it will subscribe ONLY when there's a compatible theme that supports theme colors
[!] This version still lacks a debouncer for the event. Changing the theme might invoke the event multiple times (4/5 times)
[+] added a supporting class that watches for registry changes at the accent color
Registrywatcher
dremin
left a comment
There was a problem hiding this comment.
This approach seems good to me! Just a couple tweaks left to avoid impacting performance for other themes.
Cairo Desktop/Cairo Desktop/Services/CairoApplicationThemeService.cs
Outdated
Show resolved
Hide resolved
Cairo Desktop/Cairo Desktop/SupportingClasses/RegistryEventWatcher.cs
Outdated
Show resolved
Hide resolved
…recording, manually set an event handler and disposing [CairoApplicationThemeService]: Extracted the compatible theme checking into a separate method. Now when a compatible theme is set, it will create a new Watcher and start catching events. If an incompatible theme is set. the previous watcher is disposed.
By getting the Windows's theme color through the method that I've explained here, this theme is pretty much the Flat theme, but with the addition of the theme color as a highlight for certain things.



By using a MarkupExtension, I've implemented the Opacity attribute in order to change the Opacity of the SolidColorBrush that the class returns (So that we can have different tones of the same color, such as in the Taskbar or the different button states)
The issue:
As there is not listener to any theme changes, an user might have to restart Cairo to change to a new hue