How do I change the color of desktop icon text

Desktop icon text is handled by .nautilus-desktop.nautilus-canvas-item. It is very simple to customize.

In your main GTK theme's gtk.css, underneath the initial @import url line (and not before, in my testing), put:

.nautilus-desktop.nautilus-canvas-item {
color: #ffffff;
text-shadow: 1 1 alpha (@fg_color, 0.8);
}

To see changes, do killall nautilus followed by nautilus and take a look at the Desktop.

Customize as you like: change color to #000000 for black, or, see if the (optional) text-shadow line (with nice alpha transparency) that I've included helps itself, even with white color!

For further ideas, try googling ".nautilus-desktop.nautilus-canvas-item" to see what others have done with this entry. I'm no expert at CSS or the above text-shadow code.

The other neat thing to customize the desktop icon text (and this customization is immediate with no nautilus restart required), is:

The dconf value org.gnome.nautilus.desktop font. To make text bold, simply put Bold as its value (default is empty). To change font size, add a number in there also, e.g. Bold 10. Font can be changed too, e.g. Serif Bold 10 - and I wonder what else can too.

Lastly, changing the icon view size in general via Nautilus preferences, View, 'Icon view Defaults' may make any of the above customizations more palatable by how much text width area it gives (for me, 50% zoom works VERY nicely with Bold 10 in dconf and the example css in gtk.css).

N.b. I'm in Debian Wheezy 7.8 so I hope it's not too different from Ubuntu itself here! I don't think there are any differences at time of writing.


After searching here and there to change the themes file, it seems I don't need to change anything in the theme to have this. In fact, It's not even possible without much hacking. Because Gnome Developers (for some reason only known to them) bundled most of the theme files in gresource binary file. The files in /usr/share/themes/Adwaita only for GTK-2 components. Gtk-3 files are in libgtk-3.so file and gnome-shell-theme.gresource file.

But finally I observed that the overridden file take effects actually, though it takes time.

You would override the theme. The content is same as given by Sillyman. The difference is, you write in gtk.css file in ~/.config/gtk-3.0 folder.

.nautilus-desktop.nautilus-canvas-item {
    color: blue;
    text-shadow: 1px 1px white;
}

Replace your favorite color in color field. You can even thicken the shadow by increasing the pixels.

But you need to wait some time. Try using another theme for a while after overriding it. You can also try killing nautilus using nautilus -q and starting it again.

Here is a screenshot after changing the font color in Adwaita.

gnome-shell-desktop with default adwaita theme


Here is some useful links I visited about this problem. It may help future visitors.

  • How Do I open a gresource file
  • Keeping Gnome Shell approachable
  • A script to extract gresource file
  • Building a binary from gtk-3 theme