How to make the color theme inside #ifdef more readable in Eclipse?
Asked Answered
C

5

36

I love the color themes (thanks!), but one seriously nagging issue is that the code that is #ifdef'd out, is impossible to read (and annoyingly bright). If I highlight those lines, I can read it, but I'd really really rather not see it at all. Seems to be a similar issue as the one for tool-tips, but I am hoping that there is a setting somewhere to turn off the syntax highlighting for inactive code. I have looked and not found it, but that doesn't necessarily mean it doesn't exist. I am an optimist (in this regard anyway).

Chrissychrist answered 5/6, 2012 at 19:51 Comment(1)
@Sergei answered your question. I tried it and it worked for me.Cob
H
68

You can disable #ifdef highlighting entirely by going to:

Window -> Preferences -> C/C++ -> Editor and unchecking the box "Highlight inactive code".

Also, you can change the #ifdef highlighting color by going to that same screen and changing the "Inactive code highlight" color (under "Appearance color options" heading) to a color that works better for you.

Hyalite answered 2/8, 2012 at 19:23 Comment(3)
This solution works for me on Windows using Visual Studio as compiler, probably because Eclipse thinks the symbols are undefined and so the code is all inactive. Not sure how to solve the situation where the symbols are defined and active, as here:#19040374Partite
3 years and these annoyances are still the same!Dedra
the year is 2022 and this is still an issue. arg.Ambsace
P
23

Window -> Preferences -> C/C++ -> Editor -> Appearance code options -> Inactive code highlight Choose another color. I prefer grey.

I also recommend to change occurrences background: General -> Editors-> Text Editors -> Annotations -> C/C++ Occurrences

Protuberate answered 24/9, 2014 at 11:10 Comment(0)
M
7

I found this: https://github.com/eclipse-color-theme/eclipse-color-theme/issues/35

"Preferences -> C/C++ -> Editor, “Highlight inactive code” checked, Appearance color options: Inactive code highlight."

This turns off the highlighting for the inactive parts of the code, making them readable again. I haven't found a way yet to change the highlighting color.

Mariehamn answered 14/6, 2012 at 21:27 Comment(0)
C
3

Well, I found a partial answer:

Preferences -> C/C++ -> Editor -> syntax highlighting -> preprocessor -> directives changed the foreground color to black.

Preferences -> C/C++ -> Editor -> syntax highlighting -> preprocessor -> others changed foreground color to black

Preferences -> C/C++ -> Editor -> syntax highlighting -> code -> others changed foreground color to black.

At least now I can see it. Anyone know how/where to change the background color for those blocks?

Thanks!

Chrissychrist answered 5/6, 2012 at 20:8 Comment(0)
R
2

I was looking also for write occurance background. I'll recommend for everybody to change also "Test as" to "Dashed Box" in: Preferences -> General -> Editors -> Text Editors -> Annotations -> C/C+ Write Occurrences

Revealment answered 3/1, 2020 at 11:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.