Ubuntu – How to change the background color of the menu bar


I'm trying to change the background color of the menu bar in Ubuntu but no luck.

My current theme is Ambiance.

I've tried to change the file named gtkrc in the Ambiance theme folder but no luck.

Any ideas on how I can do this?

Best Answer

If you're aware of CSS than you would have a greater control over color and style of the top panel. Following is how you can do it with Ambiance theme.

  • Open Nautilus as root, since you'll be backing up and editing files.

    gksu nautilus

  • From here, make sure all file operations that you do are from this instance of nautilus that you opened using command.

  • Navigate to /usr/share/themes/Ambiance/gtk-3.0/apps directory

    • Before you do anything, make copy of files unity.css and gnome-panel.css in the directory to somewhere in your home folder so that if you mess up anything, you can revert back the changes easily.
  • Since you want to change color of top panel in Unity, open unity.css for editing in a text-editor (gedit).

  • Now create CSS variable as follows at the topmost of the file

    @define-color dark_bg_color #DCDCDC;
    @define-color dark_fg_color #3f3f3f;
  • Note that variable dark_bg_color indicates the panel background color you want to have, set its value with the hashcode of the color you want.

  • Similarly, variable dark_fg_color indicates foreground color i.e. font color of the panel items, set it with hashcode the value you want.

  • Finally, save the file and exit. Logout, and login again, and changes you made should be visible. You can modify the values as you want, and in case you want to get back default panel color of Ambiance back, just open Nautilus as root and replace file unity.css with the one you backed up earlier.

While above mentioned method can be used to tweak color of Unity top panel, you can make similar changes in gnome-panel in GNOME classic, by making similar changes in file gnome-panel.css.

The steps I gave above might sound a bit complicated but they're pretty easy than styling any OS (AKA Windows) you think. Explore possibilities here :-)