5

On Starting gitk from CLI on ubuntu I m getting this error

vihaan@Trojan :~$ gitk
application-specific initialization failed: unknown color name "S_base3"
Error in startup script: unknown color name "S_base3"
    (database entry for "-background" in widget ".")
    invoked from within
"load /usr/lib/x86_64-linux-gnu/libtk8.6.so Tk"
    ("package ifneeded Tk 8.6.1" script)
    invoked from within
"package require Tk"
    (file "/usr/bin/gitk" line 10)

How to fix it ?

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Vihaan Verma
  • 12,815
  • 19
  • 97
  • 126

1 Answers1

5

This is pretty tricky, old school X11 stuff.

Your Xrdb contains a specification that the background colour for the gitk main window be S_base3, but nothing knows how to parse that colour name, neither Tk itself nor the Xserver, which means you get an error during toplevel widget creation when the gitk application is trying to create its main window (it's trying to parse the Xrmdb entry and doing the software equivalent of exclaiming “Wat!?”).

The Xrdb is a way of specifying defaults for various attributes of GUI applications. One of those attributes is the background colour. In your case, you've probably got an entry something like this:

Gitk.background: S_base3

Or maybe:

*.background: S_base3

The Xrdb is really maintained in a property of the X root window (RESOURCE_MANAGER) and it is global across all applications. The default contents are typically initialised from a file in your home directory (conventionally ~/.Xresources) but they could be set by your desktop environment too. Working out what's causing the problem can be tricky as so many programs can write to that property.

The xrdb program can be used to edit the resource database. For example, you can use:

xrdb -query >xprops.txt

to list the current contents to xprops.txt. Edit the file to get some sensible values in, and then use:

xrdb -load <xprops.txt

to install the new values.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Tricky indeed! Thanks for this. Worth adding that the `S_base3` colour comes from the Solarized theme. In my case I just prepended the contents of https://raw.githubusercontent.com/altercation/solarized/master/xresources/solarized onto my `xprops.txt` and then after loading it in, everything worked perfectly. Hooray! – Dave Sep 29 '14 at 16:12