DarkMode 1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DarkMode --version 1.1.0
NuGet\Install-Package DarkMode -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DarkMode" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DarkMode --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DarkMode, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DarkMode as a Cake Addin #addin nuget:?package=DarkMode&version=1.1.0 // Install DarkMode as a Cake Tool #tool nuget:?package=DarkMode&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
.NET DarkMode
Adds support for Windows 10 dark mode in .NET applications. Based on https://github.com/ysc3839/win32-darkmode.
Usage
Dark Mode can be enabled for your project in 2 easy steps:
Step 1: Enabling dark mode for your application
- Add a reference to the DarkMode.dll assembly in your application.
- Go to your project properties, and click View Application Events.
- Paste in the following code in the Application class:
- C#:
private void Application_Startup(Object sender, StartupEventArgs e) {
DarkMode.DarkMode.SetAppTheme(DarkMode.DarkMode.Theme.SYSTEM);
}
- Visual Basic:
Private Sub Application_Startup(sender As Object, e As StartupEventArgs) Handles MyBase.Startup
DarkMode.DarkMode.SetAppTheme(DarkMode.DarkMode.Theme.SYSTEM)
End Sub
Step 2: Enabling dark mode for each window
- Open the class for one of your Forms.
- Add the following code:
- C#:
protected override void WndProc(ref Message m) {
DarkMode.WndProc(this, m, DarkMode.DarkMode.Theme.SYSTEM);
base.WndProc(m);
}
- Visual Basic:
Protected Overrides Sub WndProc(ByRef m As Message)
DarkMode.WndProc(Me, m, DarkMode.DarkMode.Theme.SYSTEM)
MyBase.WndProc(m)
End Sub
- Repeat for every other Window you want to enable dark mode for.
Themes
This library supports three themes:
Theme | Description |
---|---|
SYSTEM |
Respects the system dark mode setting. |
DARK |
Forces dark mode. |
LIGHT |
Forces light mode. |
Other Methods
UpdateWindowTheme()
Updates the theme for the specified window.
Signature:
- C#:
public void UpdateWindowTheme(Form window, Theme theme)
- Visual Basic:
Public Sub UpdateWindowTheme(window As Form, theme As Theme)
Parameters:
window
: The window to update the theme for.theme
: The new theme.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0-windows7.0 is compatible. net6.0-windows was computed. net7.0-windows was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0-windows7.0
- Microsoft.Windows.Compatibility (>= 5.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DarkMode:
Package | Downloads |
---|---|
DarkMode.Helper
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.