Dark Title Bar

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

Painless
Posts: 2
Joined: Sun Nov 07, 2021 3:58 am

Dark Title Bar

Post by Painless »

Is there any way to change the colour of the title bar so that it fits with dark mode?

Windows 10 has the ability to use dark mode to change this feature globally and in the file explorer but it does not seem to apply to other programs.

Second image down shows what I mean, only difference is that I'm using View mode in windowed.
viewtopic.php?f=82&t=42012&p=170440#p170440
User avatar
xnview
Author of XnView
Posts: 44030
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Dark Title Bar

Post by xnview »

XnView Classic?
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 6356
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Dark Title Bar

Post by XnTriq »

DarkDarkEverything
Posts: 2
Joined: Wed Jul 19, 2023 6:53 am

No unfocused dark title bar

Post by DarkDarkEverything »

The titlebar still turns white when the XNView MP window isn't in focus.

Screenshots taken with Win10, dark mode on, accent color grey, titlebar checkbox on.

XNView MP in focus YES:
https://imgur.com/a/nocEMqB
Result: Windows Explorer is dark, XNView MP is dark

XNView MP in focus NO:
https://imgur.com/a/UB4mj9G
Result: Windows Explorer is dark, XNView MP is light

How should it be?
The unfocused XNView MP title bar should be dark grey (which isn't - just to clarify - my choosen accent color in the screenshots), independent of the accent color and the proposed checkbox in windows color settings.

PS: leaving the checkbox off, makes (native) focused windows have plain black titlebars (instead of accent color).
That may be a personal taste thingy, but it's even more dark, soooo I think it's even better 8)
Aaronn78
Posts: 2
Joined: Sat Sep 16, 2023 8:53 am

Re: Dark Title Bar

Post by Aaronn78 »

Painless wrote: Sun Nov 07, 2021 4:21 am Is there any way to change the colour of the title bar so that it fits with dark mode?

Windows 10 has the ability to use dark mode to change this feature globally and in the file explorer but it does not seem to apply to other programs.

Second image down shows what I mean, only difference is that I'm using View mode in windowed.
viewtopic.php?f=82&t=42012&p=170440#p170440
Unfortunately,
Windows 10's dark mode feature often doesn't extend to customizing the title bar color for third-party applications. It's a limitation of the system-wide dark mode implementation. While some apps offer their own dark themes, it's not consistent across all software.free fire name
DelphiErik
Posts: 1
Joined: Mon Sep 25, 2023 12:15 pm

Re: Dark Title Bar

Post by DelphiErik »

Creating a dark title bar for win32 applications like XnView in Windows 10/11 during dark theme is quit simple to do (dark when the window is not active). Just use the function DwmSetWindowAttribute. In Delphi/Lazarus/Pascal it is like:

Code: Select all

DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
DWMWA_USE_IMMERSIVE_DARK_MODE = 20;

TDwmSetWindowAttribute = function(hwnd: HWND; dwAttribute: DWORD; pvAttribute: Pointer; cbAttribute: DWORD): HRESULT; stdcall; // dwmapi.dll
 
if IsWindows10OrGreater(17763) then
  begin
    attr := DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
    if IsWindows10OrGreater(18985) then attr := DWMWA_USE_IMMERSIVE_DARK_MODE;
    DwmSetWindowAttribute(AForm.Handle, attr, @AValue, SizeOf(AValue));
  end;
See code/examples:
https://forum.lazarus.freepascal.org/in ... ic=59351.0
https://stackoverflow.com/questions/571 ... windows-10
https://github.com/godotengine/godot-pr ... ssues/1868

Regards, Erik