Eclipse: How do you change the highlight color of the currently selected method/expression?

JavaEclipse

Java Problem Overview


In eclipse, when your cursor is placed on a method (or other things), other places the method exists are highlighted. I'd like to change the color of this highlight, but after scouring the eclipse preferences many times in all 3 places, I have yet to find it.

Any of you Eclipse gurus know where to find this option?

Java Solutions


Solution 1 - Java

After running around in the Preferences dialog, the following is the location at which the highlight color for "occurrences" can be changed:

General -> Editors -> Text Editors -> Annotations

Look for Occurences from the Annotation types list.

Then, be sure that Text as highlighted is selected, then choose the desired color.


And, a picture is worth a thousand words...

Preferences dialog
(source: coobird.net)

Image showing occurences highlighted in orange.
(source: coobird.net)

Solution 2 - Java

For those working in Titanium Studio, the item is a little different: It's under the "Titanium Studio" Themes tab.

The color to change is the "Selection" one in the top right.

enter image description here

Solution 3 - Java

1 - right click the highlight whose color you want to change

2 - select "Properties" in the popup menu

3 - choose the new color (as coobird suggested)

This solution is easy because you dont have to search for the highlight by its name ("Ocurrence" or "Write Ocurrence" etc), just right click and the appropriate window is shown.

Solution 4 - Java

If you're using eclipse with PHP package and want to change highlighted colour then there is slight difference to above answer.

  1. Right click on highlighted word
  2. Select 'Preferences'
  3. Go to General > Editors > Text Editors > Annotations. Now look for "PHP elements 'read' occurrences" and "PHP elements 'write' occurrences". You can select your desired colour there.

Change Highlighted text colour in Eclips with PHP

Solution 5 - Java

  1. right click the highlight whose color you want to change

  2. select "Preference"

  3. ->General->Editors->Text Editors->Annotations->Occurrences->Text as Hightlited->color.

  4. Select "Preference ->java->Editor->Restore Defaults

Solution 6 - Java

in my case (Eclipse IDE 2021-06), dark theme, the issue was with the background color of "C/C++ Write Occurrences".

On each click over a variable being written in the code, the editor highlights all occurrences of that variable.

You can find this setting here:

General -> Editors -> Text Editors -> Annotations and then select 'C/C++ Write Occurrences'. And finally change che Color property.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBijanView Question on Stackoverflow
Solution 1 - JavacoobirdView Answer on Stackoverflow
Solution 2 - JavaPeter K.View Answer on Stackoverflow
Solution 3 - JavaTiagoView Answer on Stackoverflow
Solution 4 - JavaNijesh HirparaView Answer on Stackoverflow
Solution 5 - JavathomView Answer on Stackoverflow
Solution 6 - JavamrtexazView Answer on Stackoverflow