Windows dark mode github
A super lightweight automatic theme changer for Windows 10
- 🎉 Change Window light/dark theme based on set times
- 🎉 Change the Windows theme to a custom theme (see image below) and this includes changing:
- Background (image, slideshow or solid color)
- Colors
- Sounds
- Mouse cursor
- 🎉 Change system or app color theme
- 🎉 Change wallpaper for light/dark theme
You can download and install the latest release from here.
Note: Windows SmartScreen might show you this warning screen. This is because the setup file is not being signed but the app is 100% safe to be run.
I’ve built this app in my spare time to resolve my frustration with Windows 10 for not having automatic dark theme switcher. This may be included in the next releases of Windows 10 but for now here is Luna!
This is a super lightweight app built using C# and WPF technologies. It creates task schedules for light/dark theme times. There are no running processes in the background and there is not need to start when Windows starts.
3 rd party libraries used:
Command line parameters
Parameter | Description |
---|---|
/light | Switches to the light theme based on the saved settings |
/dark | Switches to the dark theme based on the saved settings |
/update | Silently checks for an update and installs it |
/clean | Cleans all task schedules created by the app |
Clone and open the solution in Visual Studio. Right-click on the project and click Restore NuGet Packages .
If you want to build the Release configuration and generate the setup executable (which is done automatically by building the Release configuration) you need to download and install Inno Setup. The output setup executable can be found under .extra\Output .
As time passes I might add new features (or contributions) to complete an experience that Windows 10 doesn’t have (yet).
To make this app better for everyone, feel free to contribute with ideas, bug reports or even better: pull requests 🙂
rossy / dark-mode.c
# include windows.h > |
# include uxtheme.h > |
# include dwmapi.h > |
# define DWMWA_USE_IMMERSIVE_DARK_MODE 19 |
extern IMAGE_DOS_HEADER __ImageBase; |
# define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase) |
struct window < |
HWND window; |
>; |
static void handle_nccreate (HWND window, CREATESTRUCTW *cs) |
< |
struct window *data = cs-> lpCreateParams ; |
SetWindowLongPtrW (window, GWLP_USERDATA, (LONG_PTR)data); |
SetWindowTheme (window, L » DarkMode_Explorer » , NULL ); |
DwmSetWindowAttribute (window, DWMWA_USE_IMMERSIVE_DARK_MODE, |
&(BOOL) < TRUE >, sizeof (BOOL)); |
> |
static LRESULT CALLBACK window_proc (HWND window, UINT msg, WPARAM wparam, |
LPARAM lparam) |
< |
struct window *data = ( void *) GetWindowLongPtrW (window, GWLP_USERDATA); |
if (!data) < |
if (msg == WM_NCCREATE) |
handle_nccreate (window, (CREATESTRUCTW *)lparam); |
return DefWindowProcW (window, msg, wparam, lparam); |
> |
switch (msg) < |
case WM_CLOSE: |
DestroyWindow (window); |
return 0 ; |
case WM_DESTROY: |
PostQuitMessage ( 0 ); |
return 0 ; |
> |
return DefWindowProcW (window, msg, wparam, lparam); |
> |
int main () |
< |
ATOM cls = RegisterClassExW (&(WNDCLASSEXW) < |
. cbSize = sizeof (WNDCLASSEXW), |
. lpfnWndProc = window_proc, |
. hInstance = HINST_THISCOMPONENT, |
. hCursor = LoadCursor ( NULL , IDC_ARROW), |
. hbrBackground = (HBRUSH)(COLOR_WINDOW + 1 ), |
. lpszClassName = L » dark-mode-test » , |
>); |
struct window *data = calloc ( 1 , sizeof ( struct window)); |
data-> window = CreateWindowExW (WS_EX_APPWINDOW, (LPWSTR) MAKEINTATOM (cls), |
L » Dark Mode Test » , WS_OVERLAPPEDWINDOW | WS_SIZEBOX, |
CW_USEDEFAULT, CW_USEDEFAULT, 200 , 200 , NULL , NULL , |
HINST_THISCOMPONENT, data); |
ShowWindow (data-> window , SW_SHOWDEFAULT); |
UpdateWindow (data-> window ); |
MSG message; |
while ( GetMessageW (&message, NULL , 0 , 0 )) < |
TranslateMessage (&message); |
DispatchMessageW (&message); |
> |
free (data); |
UnregisterClassW ((LPWSTR) MAKEINTATOM (cls), HINST_THISCOMPONENT); |
return message. wParam ; |
> |
This comment has been minimized.
Copy link Quote reply
Yakov5776 commented Mar 12, 2021
Above 20H1 uses 20 not 19
This comment has been minimized.
Copy link Quote reply
Yakov5776 commented Mar 12, 2021
You have to make a build check
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Windows dark mode github
Note for Windows and macOS users:
In IDEA versions >= 2020.3 the functionality of this plugin already exist out of the box.
Auto Dark Mode IDEA Plugin
Plugin that automatically switches the IDEA theme based on operating system settings. The plugin distinguishes between Light , Dark and High Contrast mode and the theme used for each mode can be customized. This plugin currently works for Windows and macOS.
Linux support is both limited and experimental. At the moment, the only Linux desktop environment supported by this plugin is Gnome.
By default, the following themes are used:
Mode | Theme |
---|---|
Light | IntelliJ |
Dark | Darcula |
High Contrast | High Contrast |
Operating System | x86 Support | x86_64 Support |
---|---|---|
Windows | ✔️ | ✔️ |
macOS | ❌ | ✔️ |
Linux | ❌ | ✔️ |
OS-dependent build components
When Gradle builds the plugin, it will only be able to compile native components for the operating system running the build. For example, macOS toolchains won’t be available to someone who is compiling on Windows. For this reason, this plugin depends on artifacts built by a custom GitHub Actions workflow for the platforms which cannot be compiled in the given environment. A custom Gradle plugin downloads these artifacts during the build if necessary.
This step requires a GitHub access token
For Gradle to be able to retrieve the pre-built artifacts, you need to provide a personal access token using the githubAccessToken property in gradle.properties file. The access token only needs to have the permission to read repositories. Be sure to not commit your token.
Requirements for building
With exception to Linux, this plugin only requires that a standard C++ toolchain be installed when building on Windows (i.e. VisualCpp) and an Objective-C++ toolchain when building on macOS (i.e. Gcc or Clang).
At the moment, Linux requires a standard C++ toolchain like Gcc as well as the following packages.
You can use the standard runIde task to run this plugin in a sandbox IDE. If you encounter errors like «Directory ‘[project-folder]/auto-dark-mode/base/build/idea-sandbox/plugins’ specified for property ‘pluginsDirectory’ does not exist.» , you might want to try running the task :auto-dark-mode-plugin:runIde instead.
If you experience other issues, you can try a clean environment by running the following command.
About
IDEA plugin to automatically apply system theme settings on macOS and Windows.
Windows dark mode github
Windows 10 Auto Dark Mode
Automatically switches between the dark and light theme of Windows 10 at scheduled times.
Android, GNOME Shell, iOS and MacOS already offer the possibility of changing the system design based on the time of day. So why not Windows too?
Auto Dark Mode helps you to be more productive. When it is light outside, we enable you to have a bright and clearly readable OS. After the sun starts to set, your operating system switches to a matching theme to take care of your eyes. This app saves you from the annoying way to switch the design manually in the Windows settings.
By enabling the automatic theme switcher in the app, a task in the Task Scheduler of Windows is created. This task will launch the app and set your theme. No background task, no interruption of a CMD-window, no footprint and no reliability issues. You can find many settings in the easy-to-understand user interface.
- Easy to use and clean user-interface.
- Theme switch based on custom times or the suntimes of your location + time offset.
- Desktop wallpaper switch.
- Windows .Theme-File switch, to also change Accent Color and Mouse Cursor.
- Office theme switch
- You can choose if only Apps should change their theme, or both apps and system.
- Support for accent color on the Taskbar and other system elements.
- Ability to automatically enable the grayscale color filter of Windows 10.
- Easy theme switch with a Jump-List, accessible from the Startmenu or Taskbar.
- Lightweight with 100% clean uninstall. No admin-rights needed.
Download and installing
Windows SmartScreen-Filter, your webbrowser or some antivirus software may warn you from downloading or starting this app. This is due to the missing signature license, which unfortunately I cannot afford. But from the numerous github stars you can see that many people use the program without problems.
Click here to see a VirusTotal test of AutoDarkMode_Setup.exe
Installing is pretty easy as you only need to run the setup file provided as .exe. If you want to deploy Auto Dark Mode on multiple machines, you can use the argument /verysilent to skip the installer window.
Download Auto Dark Mode from WinGet.
Download Auto Dark Mode from Chocolatey (unofficial entry).
Download Auto Dark Mode from Scoop (unofficial entry).
You still have open questions? Check out our wiki!
For developers: adding new modules
In case you want to contribute and add a new module, here’s how:
Understanding how a module works
AutoDarkMode uses a modular timer based system. Each module is registered or deregistered to a specific timer when it is enabled or disabled. The first step therefore usually consists of creating an Enabled property or config class for your module in Config/AdmConfig.cs . Only read operations are allowed to this config file. If you need write access, you will need to add a new configuration class and file and save it separately. In order to then create a module let’s take a look at what a module class looks like:
A module needs to have a constructor that calls its base constructor with exactly one string parameter (name) and one bool parameter (should the module be fired when it was enabled in the config file).
Each module has access to the configuration builder in case it needs to retrieve values from the global configuration. You can call it by invoking the ConfigBuilder singleton instance.
A module must inherit from the AutoDarkModeModule base class. The base class ensures that modules are comparable and implements the IAutoDarkModeModule interface. This ensures that all modules can be controlled by only using the interface. You will then need to override
- Fire() , which is called by the timer and
- TimerAffinity , which is the unique name of a timer this module should run on.
There are preconfigured timer names in Timers/TimerName.cs that tick at different intervals. An example on how to add new timers will come at a later point in time.
Adding a module to the module warden
Each module is automatically controlled by the module warden, which is a module itself that runs by default. It manages enabling and disabling modules on any timer based on the current configuration file state. You can add your modules to the software by changing the Fire() method in Modules/ModuleWardenModule.cs
It looks similar to this one:
To add a module, call AutoManageModule with type signature AutoManageModule#(String, Type, Bool, Bool) and takes the following parameters:
- Name: Derived from the className so you can use typeof(MyModule).Name
- Type: The module’s class used for object instantiation, this is always typeof(MyModule)
- FireOnRegistration: The module event should be triggered as soon as it is registered to a timer, boolean true/false
- Enabled: A boolean value that indicates whether the module should be running currently. Point it to your Enabled Property that you created in the configuration file or use an existing one if it fits your needs
Our final call then looks like this:
AutoManageModule(typeof(MyModule).Name, typeof(MyModule), true, config.MyModuleProperty.Enabled);
And that’s it. Your module will now be managed automatically. Next steps would be providing a user interface element that controls your module.
About
Automatically switches between the dark and light theme of Windows 10