🟣 C# / .NET 6+
Enable Dark Mode (C#)
Switches File Explorer and other system surfaces to dark mode. Applies the tweak via Microsoft.Win32.Registry.
SetDarkMode.cs
// SetDarkMode.cs
//
// Enable Dark Mode.
// Switches File Explorer and other system surfaces to dark mode.
//
// Usage: dotnet new console -o SetDarkMode, replace Program.cs with this
// file, then dotnet run.
using System;
using Microsoft.Win32;
using RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
key.SetValue("AppsUseLightTheme", 0, RegistryValueKind.DWord);
Console.WriteLine("Enable Dark Mode applied.");