Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
I'm not a daily Windows user, and Lazarus (at the moment) does not follow the Windows settings when set to Darkmode. Understandably, I have some applications where Windows users would like to see DarkMode, but the widgetset (LCL) does not support this at the time.
After a lot of searching, I did find a way that at least looks like it is darkmode - keep in mind that its pretty close but not perfect. This most likely only works with Windows 10 (I believe it even requires certain Windows 10 updats) and Windows 11. Tested with Win32 and Win64 binaries.
These are the steps (files attached - extract in project directory) to make your application start (!) in darkmode under Windows, when Windows is set to darkmode.
Note that changing dark/light mode while the application is running, is not working at the moment (suggestions/input most welcome).
Source: udarkstyle.pas and uWin32WidgetSetDark.pas from metadarkstyle
To make it work fully, I've added this to my main forms "OnCreate" event - this fixes some minor details that for some reason are not done automatically:
procedure TForm1.FormCreate(Sender: TObject);
begin
...
if IsDarkModeAppearance then ApplyDarkStyle;
...
end;
The function "IsDarkModeAppearance" detects darkmode kind-a cross platform, this is the part needed for Windows:
function IsDarkModeAppearance:boolean;
const
KEYPATH = '\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize';
KEYNAME = 'AppsUseLightTheme';
var
LightKey: boolean;
Registry: TRegistry;
begin
Result := false;
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_CURRENT_USER;
if Registry.OpenKeyReadOnly(KEYPATH) then
begin
if Registry.ValueExists(KEYNAME) then
LightKey := Registry.ReadBool(KEYNAME)
else
LightKey := true;
end
else
LightKey := true;
Result := not LightKey
finally
Registry.Free;
end;
end;
Note: The modifications I made were done in "uDarkStyle.pas" (line 254):
// mod to make sure light mode works proper as well
// was: AppMode := TPreferredAppMode(pamDefault);
if ShouldAppsUseDarkMode then
AppMode := pamForceDark
else
AppMode := TPreferredAppMode(pamDefault);
What this does is make sure things work properly in light mode (pamDefault) and dark mode (pamForceDark). The latter makes sure the titlebar is dark as well.
Based on slightly modified excellent and extensive work by Alexander Koblov (Double Commander).
Thanks for the tip! In the example I'm already using a unit from metadarkstyle (udarkstyle.pas), which I probably should have mentioned (correcting the original post in a minute). Totally overlooked mentioning that. 😊
Ulvenhout.com My home town ... Ulvenhout in the Netherlands (Noord Brabant)
VLC - VideoLAN Media Player One of the most flexible media players around and available on multiple computer platforms. Handles pretty much any audio and video type available and plays DVD as well.
Robots.txt Analyzer Very simple and effective tool for online checking of your robots.txt file without having to use Google Webmaster Tools.
Frizting Free tool to design schematics and PCB's - they even offer a very affordable PCB production service.
AlternativeTo Great resource when you're looking for alternatives for an application that you'd like to use, but might not be available on your platform or the application you have is just not doing it right.
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
squirclenomore-v1.0.3-macos.dmgDate: 2026-01-20 - Size: 5.5 MBmacOS Tahoe applies a very ugly Squircle jail to application icons - SquircleNoMore removes these and resets the normal application icon.
RenameMyTVSeries-2.3.15-Windows-x64-setup.exeDate: 2025-12-14 - Size: 49.1 MBRename My TV Series, for Windows (Intel 64 bit), a tool to assist in renaming TV Show episode files. Static builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.12-GTK-Linux-x64-static-ffmpeg.tar.xzDate: 2025-10-06 - Size: 78.3 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle comes with (large) static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.12-QT5-Linux-x64-static-ffmpeg.tar.xzDate: 2025-09-28 - Size: 78.3 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle comews with rather large static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.12-QT5-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-09-28 - Size: 1.9 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through these Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).