Internationalization Cookbook
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Dark Eclipse – for those tired of white :-)

For quite a while I wanted a dark theme for Eclipse, and I have looked for one.
And although I have seen various pages addressing various parts of this,
I have not been able to find a place where everything is put together
in a set of easy to follow steps. So here it is.

Summary

  • Install “Eclipse Color Theme” and
    Eclipse 4 Chrome Theme
  • Configure “Eclipse Color Theme”
  • Configure “Eclipse 4 Chrome Theme”
    • Download DarkEclipseTheme.zip
    • Unpack it in <EclipsePath>/configuration
    • Change “General” — “Appearance” theme to “Jeeeyul’s themes – Chrome Theme”
    • Select “Dark Eclipse” from “User’s presets” select
  • Change the console background and foreground
  • Ubuntu: change /usr/share/themes/Ambiance/gtk-2.0/gtkrc
    (tooltip_fg_color, tooltip_bg_color,
    "tooltips" ... bg[SELECTED])

And that will take us from this

EclipseDefault

 

to this

EclipseFinal

Cross-platform locations in Eclipse

“Preferences” dialog

Windows, Linux: “Window” — “Preferences”
Mac OS X: “Eclipse” — “Preferences”

“About” dialog

Windows, Linux: “Help” — “About Eclipse”
Mac OS X: “Eclipse” — “About Eclipse”

Install plugins

For this you will need two plugins: “Eclipse Color Theme” and “Eclipse 4 Chrome Theme”

From the Eclipse Marketplace

  • Go to “Help” — “Eclipse Marketplace…”
  • In the “Search” tab search for “color theme” (no quotes)
  • Install “Eclipse Color Theme” and “Eclipse 4 Chrome Theme”
    (you can click “Install” on one of them, then click “Install More” in the new dialog to
    install them both at once and save some time)

From “Install New Software…” — “Add”

If for some reason you don’t have access to the “Eclipse Marketplace…” from Eclipse, you can
go directly to “Eclipse Color Theme” and
Eclipse 4 Chrome Theme”.

Click the “Update Site” icon (green down pointing arrow), and that will give you the URL to use.

I will not describe here detail how to do it, the short version is: “Help” —
“Install New Software…” — “Add…”, and add the URL you got from Marketplace.

Configure plugins

“Eclipse Color Theme” settings

This is used to change the color for all the documents, but but not the “chrome” of Eclipse (dialogs, toolbars, etc.)

It is ready to use “out of the box”, so you can go to the “Preferences” dialog,
then “General” — “Appearance” — “Color theme” and select “something dark”. I went with “Monkai”.

Monokai

“Eclipse 4 Chrome Theme” settings

This plugin will take care of the UI itself, but needs some more tweaking.

If you don’t know your Eclipse location: go to the “About” dialog,
then click “Installation Details” and go to the “Configuration” tab (the last one).
From there write down or copy / paste in some text file the path to the Eclipse executable.
From now on I will refer to that path as <EclipsePath>.

Eclipse location

Download DarkEclipseTheme.zip, unpack it (preserving paths),
and copy it in the <EclipsePath>/configuration. You should end up with a file
named <EclipsePath>/configuration/net.jeeeyul.eclipse.themes/user-presets.xml

Now, in Eclipse again, go to the “Preferences” dialog, then “General” —
“Appearance”, change the Theme to “Jeeeyul’s themes – Chrome Theme”, “OK” and CLOSE
Eclipse (close and not restart, because we need to tinker a bit under the hood).

Jeeeyul Theme

Back in Eclipse, in the “Preferences” dialog, go to “General” —
“Appearance” — “Chrome Theme”, click the from the “Preset” drop-down arrow
(see screen-shot) and from “User’s presets” select “Dark Eclipse” (the last option).
This is why we added the user-presets.xml in the step below: the plugin comes with
some predefined themes, but they are all very light (and some of them pink :-)

DarkEclipseTheme

Click “OK” and voila, all is dark now!

The theme is modeled to work well with Monkai, but it is probably OK for most of the other dark document themes.

Some more tweaks

The console

It all looks good, until you run something. And then you notice that the console is white.

WhiteConsole

To fix that you go back to the “Preferences” dialog and from “Run / Debug” — “Console” change
the “Background color” to #303030 (Windows and Mac: 48, 48, 48) and the
“Standard Out text color” to #e5e5e5 (Windows and Mac: 229, 229, 229)
(on Windows you will have to click “Define Custom Colors” to expand the dialog to the “advanced” form.

Windows color picker   Mac OS X color picker   Ubuntu color picker

Now things look pretty good.

And if you are on Windows on Mac OS X, you are done!

Ubuntu tooltips

It all looks nice, until you have a problem and try to fix it using quick-fix, or you get
to a help topic with links. You will then notice that the links are dark-on-dark and difficult to read.

This is a know problem, and you will find several solution if you search for “ubuntu eclipse dark” (no quotes).

Instead of installing I don’t know what third-party tools, I have solved it using brute force:

cd /usr/share/themes
sudo cp -R Ambiance Ambiance_org
sudo vi Ambiance/gtk-2.0/gtkrc

In the first line I have changed tooltip_fg_color and tooltip_bg_color:

gtk-color-scheme = "base_color:#ffffff\nfg_color:#4c4c4c\ntooltip_fg_color:#ffffff\nselected_bg_color:#f07746\n
selected_fg_color:#FFFFFF\ntext_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#303030\nlink_color:#DD4814"

And in the tooltips section (line 504 for me, but that might be different) I have changed bg[SELECTED]:

style "tooltips" {
   xthickness = 4
   ythickness = 4

   bg[NORMAL]        = @tooltip_bg_color
   fg[NORMAL]        = @tooltip_fg_color
   bg[SELECTED]      = @tooltip_bg_color

   engine "murrine" {
       rgba = TRUE
   }
}

I have found these values to work pretty nicely with this dark theme, and without negative side-effects for other applications.

Now go to Ubuntu main “Menu” — “Preferences” — “Appearance” and change the theme to something else, then back to “Ambiance”.

You need to restart Eclipse, but this is it, you are done.

Tooltip colors are fine

Final notes

I have found the above settings to work nicely on Windows 7, Mac OS X, Ubuntu, and Fedora, with Eclipse 4.3 and 4.2.
And I have tweaked the theme to fix all the problems I have found, and seems to work pretty well now.

But if you notice any problems you can either comment here, or fix it yourself.

My fixes ended up in the “Preferences” dialog, “General” — “Appearance” — “Chrome Theme”, the “CSS” tab.
To find out what to fix I used the
E4 CSS Editor” and
E4 CSS Spy” plugins.
These tools will help you find out what each widget is (the “Spy” part) and
temporarily tinker with the styles (the “Editor” part).

Enjoy!

Bonus / self-promotion :-)

Maybe you’we noticed that in the screen-shoot of the Dark Eclipse (at the beginning of the article) the text in console has some red and green.
(if you did not, take another look :-)

That is because I have support for ANSI escape sequences, added by my
ANSI Escape in Console” plugin.

21 Comments to “Dark Eclipse – for those tired of white :-)”

  1. Torque says:

    Hey, I just tried this, and it didn’t work, and after searching the comments, your new file for Chrome 2 worked out perfectly. I noticed that you mentioned putting it in the article, but I guess you never got around to it – please do, it looks great, and I’m sure a lot of people will give up in frustration before going through the comments.

  2. Micko says:

    For those of you who are able to upgrade to Eclipse 4.4 (Luna), this is no longer necessary. Luna has a built-in dark theme.

    1) In Eclipse, go to Window -> Preferences
    2) General -> click on Appearance
    3) Theme -> Choose Dark

    Beware that, annoyingly, the Java editor pane will still have a white background. And there doesn’t seem to be a way of changing this in General -> Appearance -> Colors and Fonts.

  3. Lars Vogel says:

    Eclipse 4.4 contains a default Dark theme. See http://blog.vogella.com/2014/03/11/dark-eclipse-ships-with-eclipse-luna/

    • Mihai says:

      I know, but thank you.

      Pretty happy about it, although it has a “tint” that I don’t quite like, and some labels are not quite readable.
      But it is definitely nicer to have something out of the box.
      And I am pretty sure it will be fine-tuned a bit more.
      I think it is also available for Kepler as “Moonrise” (http://marketplace.eclipse.org/content/eclipse-moonrise-ui-theme)

      Anyway, happy to be out of this business :-)
      Mihai

    • Mihai says:

      BTW, just noticed after answering, that you are Vogel, from http://www.vogella.com/!
      Wonderful site, some of the Java tutorials there saved me many hours.
      Thanks a lot for the great work there!

      Best regards,
      Mihai

  4. Wesley says:

    First, THANK YOU! I’m using Eclipse version Kepler Service Release 2 on OSX and the only thing I’m having trouble with is getting the Dark Theme as a preset. I’ve unzipped and added the net.jeeeyul.eclipse.themes folder to my configuration file but the preset won’t show up and when I try to add it, it won’t let me. It wants an Eclipse Preference File and the user-presets file is .xml. Any ideas?

    • Wesley says:

      and I’m using 4.3.2

    • Mihai says:

      Sorry, but I find it a bit difficult to follow.
      “but the preset won’t show up” seems to indicate that the files are unziped in the wrong place, or that the jeeeyul is not already installed.

      “It wants an Eclipse Preference File and the user-presets file is .xml”
      Who / what wants that?

      Hmmm, I am starting to suspect something…
      What version of “Jeeeyul’s Eclipse Themes” do you have?
      If it is 2, then that’s probably the cause.
      My tutorial and my files are for 1.x (latest one tested was 1.7.4)
      From what understand version 2 has some significant changes.
      I might have to update the tutorial for that…

      • Wesley says:

        I apologize for the vagueness. By “the preset won’t show up” I mean that when go to Eclipse>Preferences>General>Appearance>Jeeeyul’s Themes, and select the coat hanger-looking drop down menu that gives me the options (Preset)(User Preset), under User Preset I only have the options to (Save As New Preset) (Manage Preset). There is not option for the Dark Theme preset. And when I said that “It wants and Eclipse Preference file” I meant that when I went to manage presets to import a preset, eclipse/finder would fade out and keep me from selecting file options that weren’t .epf. Despite my talent to confuse, you solved the problem. The version of Jeeeyul’s Eclipse Themes I have is 2.1.6. I’ve tried to find the earlier releases but no luck so far. Any idea where I could find them?

      • Mihai says:

        OK, so I really suspect that version 2 of Jeeeyul’s Eclipse Themes is the problem.
        I will have to install it and create a config for that too.
        Probably over the week-end.
        So, come back soon :-)

      • Wesley says:

        Will do, thanks Mihai I really appreciate it.

      • Mihai says:

        I have put something together for version 2: http://mihai-nita.net/wp-content/uploads/2013/09/DarkEclipseEpf.zip
        There is still some fine tuning to do, but should work for now.
        Once I am happy with it I will update the article.

      • Wesley says:

        It worked perfectly! Thank you so much!

  5. Henrik says:

    Thank you very much for making this available!
    My Eclipse Kepler on Mac OS X maverick just got really sweet thanks to you!
    I tried the color theme you mentioned but I am currently using Sublime text 2.
    One little thing is when in a java editor, the file being edited is highlighted in the outline and in the project explorer as expected but the background color is a light grey.
    Is that intentionally and if so, how can I make it a bit darker so that it does not stand out so much?
    Btw. I did not change anything to get the console fixed.
    Thanks again for your work.
    Regards

    • Mihai says:

      Did some digging, and unfortunately that color comes from the OS and there is no way to change it for Eclipse only.

  6. D says:

    Cu scrollbarul nu se poate face nimic ?

    • Mihai says:

      English translation: “Can’t do anything about the scrollbar?”

      I don’t think so, I think they are native OS scrollbars.
      But I will try, maybe…

  7. pdresslar says:

    This is terrific, thank you. FWIW, the configuration file for Dark-Eclipse goes into /configuration/net.jeeeyul.eclipse.themes at least for my install of Kepler.

    Also, EGit decorations will break this CSS config by default. You can, however, change them using Preferences>General>Appearance>Colors and Fonts settings (set Uncommitted Change(Foreground) to 208,208,208 ; set Uncommited Change(Background) to 49,49,49). Surely this override could go into the config file with a bit more tracking down of the correct elements, but this is a quick fix.

    • Mihai says:

      > the configuration file for Dark-Eclipse goes into /configuration/net.jeeeyul.eclipse.themes

      The DarkEclipseTheme.zip already contains the net.jeeeyul.eclipse.themes folder.
      But it might be possible that some way of unzipping it “flattens” the thing and you get no folder.
      And on Linux it is sometimes a bit of a problem to find out where things go, with so many “flavors” :-)

      > EGit decorations will break this CSS config by default

      That is a problem with all kind of other formats.

      The color of the “things in the editor” is controlled by “Eclipse Color Theme.”
      And there is no way that one plugin can “know” of all the file formats supported by 3rd party additions to Eclipse,
      each one with its own color palette (unfortunately).

      I think it would be nice if Eclipse would have the concept of “default Eclipse colors” for most common language elements
      (strings, characters, numbers, keywords1, keywords2, keywords3, comments, etc.)
      Something like this: http://eclipsecolorthemes.org/?view=theme&id=1

      So that an editor can go with that default, or its own thing.

      But meantime I am considering a plugin that can look at the Java colors and copy them to other editors.
      Very configurable, with an easy way to add color mappings to new file formats.
      Still prototyping…

      But meantime I will probably add a note to the main article about that.

      Thank you!

Leave a comment