Seems like people have caught on to the need of being able to create and manage themes in Eclipse. The Eclipse Color Theme plugin does this very well and also works like a charm with FDT.
Unfortunately this is still only changing colors of the text editor and not the whole IDE.
I found this very interesting post called “Hex colors & bitwise operators” on www.tracestatement.com a while back and I’ve been meaning to blog about it.
// From hex value to r,g,b values
var hex:uint = 0xFF8811;
var r:uint = rgb >> 16;
var g:uint = rgb >> 8 & 0xFF;
var b:uint = rgb & 0xFF;
//From r,g,b values to hex value
hex = (r << 16) | (g << 8) | b;
This tiny bit of code allows you to rapidly subtract the Red, Green and Blue values from a hexadecimal colour code. Once you have the R, G, B bits you can then manipulate them and once done convert them back to a single Hex value.
An important thing to remember is bitmasking, this can be used to switch a set of bits either on or off.
I’ve been wanting to be able to use a different color-scheme (or theme) for FDT for a while. After some investigation I found out how to do this.
I’ve created the color scheme above and stored in an epf file, you can download it here:
http://ansuz.nl/toys/fdt/eclipse_fdt_dark_01.epf (right click and save as…)
Creating the scheme
- Modify your preference for text appearance (see ‘Eclipse + FDT colors‘)
- Hit File > Export > General > Preferences and save in a convenient location
- Open the saved file in your favourite text editor and remove everything that’s not color related. There are a couple of exceptions to this though, see ‘Eclipse + FDT colors update‘. Others you’ll probably find out in a trial and error proces.
- Add ‘file_export_version=3.0’ to the top of your file, so Eclipse knows what version the preferences were exported for. (You can also not delete this line in step 3.) If you omit adding ‘file_export_version=’ the importing of the preferences will fail.
- Save the file and you’re done!
Importing a scheme
- Hit File > Import > General > Preferences
- Click ‘Next’.
- Select the scheme to import and click ‘Finish’
- All done!
I figured out what was missing in my previous attempt to store and then load my color preferences. You need to include what version of Eclipse the preferences file is exported for.
A couple of other things include some boolean settings for not using the system background color and using the ruler (line numbers).
I’m trying to figure out a nice way to apply a color theme to Eclipse. So far no luck, but I have found the places where to edit color settings.
First got to Window > Preferences, then change the color settings in the following locations:
- General > Editors > Text Editors
- General >Appearance > Color and Fonts
- FDT > Editor > Colors
- FDT > Editor > Semantic Highlight
Some ideas to explore:
http://drnicwilliams.com/2006/08/08/textmate-theme-for-radrails/ (Modify the *.epf file to include FDT settings? Create a nice color scheme and export settings using File > Export > General > Preferences)
http://www.willianmitsuda.com/eclipse-plugins/eclipse-skins/ (Skin plug-in, see how to get this to work with FDT)
Update: Exported preferences, now trying to figure out how to strip all non color scheme related information.
Update 2: Found a doable way to create a color scheme for FDT, read the howto.