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

3

11

I want to change the highlight color of references showing in Eclipse's Search View after CDT find reference operation (right click on code -> References -> any). How can I do this?

Note: this is different from standard match highlight color.

Illustration: enter image description here

Diandiana answered 17/11, 2015 at 19:11 Comment(1)
solution found in this ticket #10923434 by @MasterHD's replyTafoya
C
14

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
Curet answered 25/1, 2016 at 15:59 Comment(6)
Both does the same thing anyway. The 1st one is better if you intend to share your theme as it's the native way to proceedCuret
Really useful, I have added this info to Bug 468206Indicia
Also you can set org.eclipse.cdt.ui.ColoredLabels.writeaccess_highlight in the same way for the beige write access highlights.Fundus
Check out this for perfect answer: :) linkLello
Gents, there are news of some possible easier (purely-GUI-based solution) for Neon (disclaimer: I haven't tried it): bugs.eclipse.org/bugs/show_bug.cgi?id=468206 #10923434Diandiana
none of these workaround work for me, neither Neon nor OxygenAcerbic
I
3

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.

Indicia answered 17/11, 2015 at 19:40 Comment(1)
I tried to edit the plugin.xml from the jar and repack it, not working neither :(Acerbic
A
0

Found a workaround that works for me. With eclipse closed:

  • unpack <eclipse installation folder>\plugins\org.eclipse.cdt.ui_6.3.0.201802261533.jar
  • edit plugin.xml and change the color to your taste
  • put this file back into the jar
  • delete <eclipse installation folder>\configuration\org.eclipse.core.runtime\.mainData.1
  • start eclipse
Acerbic answered 23/4, 2018 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.