I tested saving your sample CSS file into a file emacs-zufall.css
which I imported from my locally modified gtk.css
file using
@import url("apps/emacs-zufall.css");
and it worked: my menubar turned into psychedelic green color with black text.
I am guessing your emacs is not even reading the file in the location you created it. The location depends on the name of the theme. I am using theme Orion
and emacs is trying to load read gtk.css
using path
~/.local/share/themes/Orion/gtk-3.0/gtk.css
and if failing then from
~/.themes/Orion/gtk-3.0/gtk.css
Easiest way to see this to just trace the system calls. If using Linux, you can run
$ strace -o strace.log emacs &
and search for string themes
in strace.log
using your favorite pager or editor (for exmple emacs
!). There is a lot of output, but you can quickly find the path using that search string (to match the attempts to find the theme file). Here's what I found in my strace
output when I temporarily moved the locally modified theme directory away:
access("/home/foof/.local/share/themes/Orion/gtk-3.0/gtk.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/foof/.themes/Orion/gtk-3.0/gtk.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/Orion/gtk-3.0/gtk.css", F_OK) = 0
If you see similar ENOENT
result indicating your emacs
and you have different opinion about where to look for the CSS files, you can:
copy the theme to your local directory and do the necessary modifications:
$ mkdir -pv ~/.local/share/themes/Orion
$ cp -ai /usr/share/themes/Orion/gtk-3.0 ~/.local/share/themes/Orion/
add the @import statement to the locally modified gtk.css
file:
@import url("apps/emacs.css");
and create or make sure file apps/emacs.css
exists in the expected location with the desired modifications.
Remember to launch emacs
using command line to see any possible CSS related errors. In my experience there is no theme caching so it was possible to have multiple emacs applications open with different theme settings contrary to what the linked superuser answer said; but this might be because I am not running Gnome desktop system (KDE is my choice).
If you are using another operating system, then there should be other utility to trace the system calls. OS X and maybe other BSD systems use DTrace etc. You could also consider running emacs under debugger if you cannot find how to trace the system calls on your system, though this is much more troublesome.