Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiIDERAD Studio

Easily Customize Your Delphi VCL Application With Dark And Light Themes According to Windows Mode

Many times we need to override windows default settings or customize our application by code, irrespective of user settings in windows for better user experience. Your application has been built with options to apply certain themes and the user also has the flexibility to change Windows themes for entire windows/apps. In this case, your application user experience should not be affected by user system settings. This post can guide you to set the themes in your Windows VCL application.

How to check whether dark mode is enabled?

  • Press Windows + R -> Type Regedit cmd in Run Command window.
  • Navigate to the folder: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize.
  • Check AppsUseLightTheme Keyword and if its value is 1 then the windows apps theme is in Light mode and 0 means it’s in Dark mode.

How to set the themes in Delphi from project options :

In Delphi IDE, Go to -> Project Menu -> options -> appearance -> Select the available themes suitable for your application. Carbon for Dark theme for example.

You application theme settings:

If you want to give a better user experience explicitly irrespective of (or) according to windows themes selected by the user in the machine, first programmatically check the app theme mode. Navigate to the following location Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize and get the keyword AppsUseLightTheme value. Accordingly build your logic of setting the VCL theme using the VCL API to set the themes.

Note: Platform specific conditional defines need to be included accordingly if it is cross platform application.

Check the below Video for the full demonstration of setting the dark/light theme Vice-versa for a VCL application.

Check out the latest Delphi 10.4.1 which supports High DPI Styles and VCL per control styling for your applications.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts
DelphiShowcase

Visualize Our Astounding Planet's Journey Around The Sun

CodeDelphiIDERAD Studio

Add The Powerful Angular Web Framework To Your Delphi Apps

C++Code

LearnCPlusPlus.org :: Can C++ Builder Beat GNU C++ & Delphi?

C++CodeDelphiRAD Studio

How To Use A REST AI API The Really Difficult Way

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES