Color Schemes for Eclipse CDT – Part 2
The next step of our journey involved trying to recreate one of the themes we found in through Eclipse’s IDE Preferences. Believe me, this is no easy task. There are like 4 different places that colors, highlights and fonts are stored.
The most are stored in: Window, Preferences, C/C++, Editor, Syntax Coloring
There you will find options to color built-in types, typedefs, pre-processor directives, strings, etc. All the things you would expect to find. A nice feature they have for many of the types is the ability to disable syntax coloring. There were a few that I just chose to disable or keep disabled because it was getting too cluttered. I still think its too cluttered actually. Judge for yourself:
Standard Theme / Coloring
My Twilight-ish Theme / Coloring
Following the trend of having settings all over the place, these customizations are contained in four files:
- …/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.cdt.ui.prefs
- …/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs (weird, I know).
- …/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs
- …/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs
The large majority of the settings are in the cdt.ui.prefs file:
semanticHighlighting.typedef.color=117,135,166 semanticHighlighting.enum.color=143,157,106 c_type=117,135,166 semanticHighlighting.functionDeclaration.color=155,133,157 useQuickDiffPrefPage=true c_string=169,188,135 c_single_line_comment=79,148,205 useAnnotationsPrefPage=true semanticHighlighting.macroSubstitution.color=117,135,166 semanticHighlighting.method.enabled=true semanticHighlighting.functionDeclaration.bold=false semanticHighlighting.macroSubstitution.italic=true c_comment_task_tag=79,148,205 spelling_locale_initialized=true semanticHighlighting.globalVariable.enabled=true semanticHighlighting.method.bold=true c_comment_task_tag_italic=true c_braces=205,168,105 c_numbers=207,106,76 semanticHighlighting.class.color=233,192,98 semanticHighlighting.enumerator.color=143,157,106 semanticHighlighting.field.enabled=false semanticHighlighting.macroSubstitution.enabled=true c_keyword=233,192,98 semanticHighlighting.function.color=155,133,157 pp_default=143,157,106 c_multi_line_comment=79,148,205 semanticHighlighting.externalSDK.enabled=false semanticHighlighting.function.enabled=true semanticHighlighting.method.color=155,133,157 eclipse.preferences.version=1 semanticHighlighting.methodDeclaration.color=155,133,157 semanticHighlighting.problem.color=224,125,87 pp_header=143,157,106 semanticHighlighting.staticMethod.enabled=false semanticHighlighting.globalVariable.color=207,106,76 semanticHighlighting.templateParameter.enabled=false c_default=248,248,248 c_multi_line_comment_italic=true semanticHighlighting.function.bold=false c_operators=173,216,230 c_single_line_comment_italic=true semanticHighlighting.staticField.color=155,133,157 pp_directive=233,192,98
The other places to look for coloring options are:
- Window, Preferences, General, Editors, Text Editors, Appearance Color Options
- Window, Preferences, General, Editors, Text Editors, Annotations, Occurences
I’m going to mess around and create one more theme by hand — then try to figure out the best way to implement a solution that will be full-featured and allow for easy transition between themes. Maybe a webapplet where you can design the theme (or customize a pre-existing one) and then download it? Who knows…
Categories: programming, tips and tricks
Could you post your current theme for CDT (and the global configs), so that other people can use it?
by Harry on Nov 3, 2009 at 11:18 am
Sure, in fact I’ve been meaning to post these. Here you go Harry.
http://blog.edwards-research.com/2009/11/color-schemes-for-eclipse-cdt-part-3/
Regards,
Jim
by Jim on Nov 3, 2009 at 2:04 pm