An option inside Power Toys that automatically switches between Windows 10's light and dark theme at a certain time of day, or at sunset and sunrise, similar to how Night Light does in Windows 10. Feature could also be configurable so that the user can choose to have the automated process switch only app theme, or both app and system theme.
We're prioritizing v1 work items but if a community member wants to help build this out, happy to dedicate time to this.
Really like this idea! Here's a mock-up for the settings screen this feature would need to have.
XAML source (WinUI 3.0 Alpha) in this repo: https://github.com/niels9001/PowerToysUXWinUI3Alpha
It鈥檇 also be very nice if we could choose two existing themes and set each one for day/night time (so not only the Light/Dark theme is changed, but also the wallpaper)
Somebody referenced this project that does this: https://github.com/Armin2208/Windows-Auto-Night-Mode
Cool project but that is GPL v3. We cannot use any source code from that project due to that license.
I do this in EventGhost using registry and cmd. Just chipping in case it helps.
Light:
REG ADD "HKCUSoftwareMicrosoftWindowsCurrentVersionThemesPersonalize" /V AppsUseLightTheme /T REG_DWORD /D 1 /F
CMD: "%localappdata%MicrosoftWindowsThemesDay.theme"
Dark:
REG ADD "HKCUSoftwareMicrosoftWindowsCurrentVersionThemesPersonalize" /V AppsUseLightTheme /T REG_DWORD /D 0 /F
CMD: "%localappdata%MicrosoftWindowsThemesNight.theme"
Thanks @mikeparkie! Investigation is a massive part of the work!!!
I also use the exact commands @mikeparkie referenced. I think I found them through a Google search, but I can confirm it works.
I use Task Scheduler; the action is 'Start a Program', command reg
, with the argument set for light/dark theme. Granted, this is just a timed trigger.
One quirk I've noticed with this method: if you leave a File Explorer window open during the change, most of the Explorer UI honors the switch--the 'folder contents' portion of the window does not. It requires closing the File Explorer window and opening a new one to produce the expected result of a fully themed Explorer window.
Point is, it works, but it's not always elegant (not sure if it's possible to force reload the open windows entirely?)
@bradleybowman agreed, it's relatively crude in it's execution, but it works for the most part. And actually I didn't face any issues with the UI, other than the ribbon redraws first, followed by the rest of the frame/contents, take about 2 seconds in total. Enough to notice a transition.
If it's a content/icon refresh, then theres always the "ie4uinit.exe -show" command which should reload the icon cache (but I'm guessing a little there).
Wrong @ in the comment
@BradleyBartlett whoopsie, sorry about that :)
Luna is a new project up on GitHub that does this.. Light-weight and made with WPF. MIT license (@crutkas)
@mikeparkie I noticed last night when the theme switched, it did redraw the File Explorer window properly. It's probably worth noting I'm on the 'Insider Fast Ring', so there's always the factor that I'm on a potentially unstable build.
@niels9001 I checked out Luna. The interface is slick and in my opinion just how an average end user would like to set up light/dark mode switching
If you check through that project though, it's essentially doing the same thing I am. Luna creates the Task Scheduler tasks at the times you select, and if you check out Luna/Helpers/RegistryHandler.cs:
_(Hopefully I'm allowed to crosspost this, if not please let me know and I'll remove)_
public static void AppsUseLightTheme(bool enabled)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", true);
if (key != null)
{
key.SetValue("AppsUseLightTheme", enabled ? 1 : 0, RegistryValueKind.DWord);
}
}
^ It uses the same method that Mike and I mentioned.
Nothing against the Luna app, I really do like the interface...it just seems that, at present, theme switching falls into the 'registry hack not-elegant-but-it-works' category
@bradleybowman likewise, I'm also running fast ring insider builds. I can't whether my previous non-insider builds had the issue or not. I'm not rebuilding to test it out :)
@bradleybowman No problem, I'm excited about this. It's a 'small' feature but I think a lot of users would be happy with it. Are you guys planning to pick this up? I'd be happy to help with the XAML/UX within Settings.
As others have mentioned above I also use the Registry value triggered at specific times in the task scheduler to toggle on dark mode at night.
However - I also use this registry key as well to make sure dark/light mode is applied to Windows:
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /V SystemUsesLightTheme /T REG_DWORD /D 1 /F
Cool project but that is GPL v3. We cannot use any source code from that project due to that license.
Hello! I am the developer of the Auto Dark Mode App for Windows. I am interested in working together as I could change the license. Especially creating a new public theming API would be in the interest of all of us. In return of sharing my code with you I need some help. How can I contact you?
cc @crutkas
@armin2208, lets chat! [email protected]
I had the exact same idea (connecting light/dark theme to Nightlight) a while ago. I sent in the suggestion via Windows Feedback hub. Seems like the best place for this idea, to me - really hoping it'll make it's way into Windows some day. But when Windows itself does not have this option, PowerToys looks like a good alternative.
Any news? Looking forward to this.
Any news? Looking forward to this.
Firstly, we have agreed for a solution. Auto Dark Mode will be a part of PowerToys in the future.
But this feature will be a post-release feature. The PowerToys team is busy with finalizing their current work, while we are busy to improve our new theme switch engine. And the Auto Dark Mode team has a little break ;)
You can expect this feature in a PowerToys Beta in november or december.
@Armin2208 any news on this :)?
no
Most helpful comment
Hello! I am the developer of the Auto Dark Mode App for Windows. I am interested in working together as I could change the license. Especially creating a new public theming API would be in the interest of all of us. In return of sharing my code with you I need some help. How can I contact you?