How to change highlight color of references in Search View in Eclipse CDT?

It seems that these colours are not editable and are therefore hard coded in a way that (clearly!) does not work well with a dark theme.

This is the relevant part from the org.eclipse.cdt.ui/plugin.xml:

  <colorDefinition
        id="org.eclipse.cdt.ui.ColoredLabels.match_highlight"
        isEditable="false"
        label="%Dummy.label"
        value="206, 204, 247">
  </colorDefinition>

A small change to the plugin.xml allows the colour to be editable:

  <colorDefinition
        categoryId="org.eclipse.cdt.ui.presentation"
        id="org.eclipse.cdt.ui.ColoredLabels.match_highlight"
        isEditable="true"
        label="Match Highlight"
        value="206, 204, 247">
  </colorDefinition>

And then you can edit the background colour and fix your problem.

This is a known issue in CDT (Bug 468206), contributions welcome.


I found out two easy solutions to this problem:

1) Create a new file and add those lines (extension of the file needs to be .epf):

file_export_version=3.0
/instance/org.eclipse.ui.workbench/org.eclipse.cdt.ui.ColoredLabels.match_highlight=128,0,128 

You might change the color value to match your theme

Then go to File -> Import -> General -> Preferences

Browse to the newly created file and click the Finish button

2) Go to [workspace-location]/.metadata/.plugins/org.eclipse.core.runtime/.settings

Edit org.eclipse.ui.workbench.prefs file and add the line

org.eclipse.cdt.ui.ColoredLabels.match_highlight=128,0,128