Skip to content

Dark Mode

In a ScriptoForm, the SetColorMode() static .NET function can be used to configure the visual theme for the Form, allowing it have a “Dark Mode” appearance. The supported values for this function are:
  • Dark: Enforces a dark theme appearance regardless of the host Windows OS configuration.
  • Classic: Enforces the standard light theme (the legacy Windows Forms appearance) regardless of OS configuration.
  • System: Dynamically inherits the color theme directly from the user’s active Windows OS settings.
PowerShell
#region Assemblies
Add-Type -AssemblyName System.Windows.Forms
#endregion
#region Appearance
[System.Windows.Forms.Application]::EnableVisualStyles()
[System.Windows.Forms.Application]::SetColorMode("Dark")
#endregion
The SetColorMode() function is defined in the “System.Windows.Forms” namespace and must be called after loading the Assembly for it. As best practice, this function is typically called after the EnableVisualStyles() function is called in the Appearance region.

Application.SetColorMode Method (System.Windows.Forms) | Microsoft Learn