How to change the background color of GTK titlebar

Please is is possible to change the background color of GTK titlebar via CSS?

I have tinkered with various combinations of .headerbar and .titlebar.default-decoration (I looked through the gtk-contained.css file) CSS classes but no luck.

I want to achieve a uniform theme in my application. For example, if the general theme of the application is blue, I want the titlebar to be some shade of blue.

Kindly point me in the right direction if it is possible to achieve this.

I have also considered creating a custom titlebar but I won’t have the native windows icons (minimize, maximize and close).

P.S. I am targeting Windows platform and developing using Msys2.


I am afraid that you need to drop the decorations and use a costume Headerbar instead.

Of course those are available as well.

Thanks for your response @MichiB Using the custom HeaderBar does not provide native look for windows icons (Minimize, Maximize and Close Button).

I am targeting Windows for the application.

Is there a workaround for this? Thanks.

If you’re wanting to tweak a Win32 titlebar you’re going to have to look at Win32 and call things on the HWND yourself

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.