Friday, June 14, 2013

Eclipse: The Dark IDE - Linux edition

Not so long ago I've stumbled upon http://ethanschoonover.com/solarized. It is kind of magical set of dark and light themes for range of IDE/editors/widgets etc. and it looks kind of good. I was thinking for a while about background and foreground color contrast - it could be illegible - but it is written that colors comply to CIELAB spec and this solution was tested on variety of devices. So it has to be true! ;)

Since I am spending so much time working with Eclipse, at one time I've decided to try and take Google's advice - darker colors could may reduce eye fatigue (especially when you're coding at night). I'm presenting you steps how to fully theme Eclipse with dark theme (Linux edition).

end result as incentive

Eclipse

At the beginning we have:

To apply above themes you have to first install Eclipse Color Themes and Chrome Theme.

After applying new theme (for Aptana and Eclipse) I've come to see that Aptana's background is a little darker than Eclipse's so I've changed some colors for appropriate - from base scheme (download changed theme).
Our next step is to change color of tabs and other Eclipse widgets, we will use Chrome Theme for it. There you can download already prepared configuration file for ui - you need to place it in workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings. In case of manual fun you will need to remember about adding CSS line from answer on stackoverflow.com:

#org-eclipse-e4-ui-compatibility-editor * { background-color: #002b36; }

GTK

Happily GTK+ 2 theme is easy to find: https://github.com/heichblatt/gtk2-theme-solarizeddark.
You don't need it enabled for whole system, just Eclipse will suffice.

GTK2_RC_FILES=~/.themes/solarized.gtkrc /mnt/sandbox/eclipse/eclipse

Desktop file

If you want to run styled Eclipse from your Desktop Menus, you'll need change Exec part of its .desktop file. Below is whole file as used by me:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse IDE
Comment=Eclipse Programming IDE
Exec=env GTK2_RC_FILES=~/.themes/solarized.gtkrc /mnt/sandbox/eclipse/eclipse
Icon=/mnt/sandbox/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Application;Development;

Sadly, event after everything is properly styled you can still find editors where colors will be wrong. For example - Twig editor from Symfony2 package. (fixed Twig configuration)