てけもぐ Tech 忘備録

Color configuration on gnome panel theme

対象読者

gnome/gtk user

解決すること

change menu bar color for gtk applications

内容

I'm using ubuntu22.04LTS:

$ cat ~/.config/gtk-3.0/gtk.css 
headerbar {
  background: #131313 linear-gradient(to top, #4C6059, #597F73);
}

This file is saved ongetk-4.0 directory for gtk-4.0 application.

I search pages but I could not find it to change menu bar color in my env.

Some info I uses until I find it:

The default css source seems located in/usr/share/themes/$(gsettings get org.gnome.desktop.interface gtk-theme)/gtk-3.0/gtk.css

The theme name in your settings can be seen also on gnome-tweaks tool.

This file has contents of the following contents in my theme(Yaru-viridian-dark).

@import url("resource:///com/ubuntu/themes/Yaru-viridian-dark/3.0/gtk.css");

The file '/com/ubuntu...' is not exist on file system. It looks gtk load the compiled one named 'gtk.gresouce' in same directory. It can be extracted by "gresource" tool.

$gresource extract  /usr/share/themes/Yaru-viridian-dark/gtk-3.0/gtk.gresource  /com/ubuntu/themes/Yaru-viridian-dark/3.0/gtk.css > ~/gtk.css

In this extracted file, we can see "headerbar" item defining header color.

I checked several applications what kind of files are loading by strace command, and ~/.config/gtk-* looks best place for my purpose.

Tags