如何使#ifdef 中的颜色主题在 Eclipse 中更具可读性?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10903951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make the color theme inside #ifdef more readable in Eclipse?
提问by Billy Pilgrim
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).
我喜欢颜色主题(谢谢!),但一个严重的问题是#ifdef 输出的代码无法阅读(并且令人讨厌地明亮)。如果我突出显示这些行,我可以阅读它,但我真的宁愿根本不看它。似乎与工具提示的问题类似,但我希望有一个设置可以关闭非活动代码的语法突出显示。我看过但没有找到,但这并不一定意味着它不存在。我是一个乐观主义者(无论如何)。
回答by Thuener
You can disable #ifdef highlighting entirely by going to:
您可以通过以下方式完全禁用 #ifdef 突出显示:
Window -> Preferences -> C/C++ -> Editor and unchecking the box "Highlight inactive code".
窗口 -> 首选项 -> C/C++ -> 编辑器并取消选中“突出显示非活动代码”框。
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.
此外,您可以通过转到同一屏幕并将“非活动代码突出显示”颜色(在“外观颜色选项”标题下)更改为更适合您的颜色来更改 #ifdef 突出显示颜色。
回答by Sergei
Window -> Preferences -> C/C++ -> Editor -> Appearance code options -> Inactive code highlight Choose another color. I prefer grey.
Window -> Preferences -> C/C++ -> Editor -> Appearance code options -> Inactive code highlight 选择另一种颜色。我更喜欢灰色。
I also recommend to change occurrences background: General -> Editors-> Text Editors -> Annotations -> C/C++ Occurrences
我还建议更改出现背景:General -> Editors-> Text Editors -> Annotations -> C/C++ Occurrences
回答by John
I found this: https://github.com/eclipse-color-theme/eclipse-color-theme/issues/35
我发现了这个: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."
“首选项 -> C/C++ -> 编辑器,选中“突出显示非活动代码”,外观颜色选项:非活动代码突出显示。
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.
这将关闭代码非活动部分的突出显示,使它们再次可读。我还没有找到改变高亮颜色的方法。
回答by Billy Pilgrim
Well, I found a partial answer:
好吧,我找到了部分答案:
Preferences -> C/C++ -> Editor -> syntax highlighting -> preprocessor -> directives changed the foreground color to black.
首选项 -> C/C++ -> 编辑器 -> 语法高亮 -> 预处理器 -> 指令将前景色更改为黑色。
Preferences -> C/C++ -> Editor -> syntax highlighting -> preprocessor -> others changed foreground color to black
首选项 -> C/C++ -> 编辑器 -> 语法高亮 -> 预处理器 -> 其他将前景色改为黑色
Preferences -> C/C++ -> Editor -> syntax highlighting -> code -> others changed foreground color to black.
首选项 -> C/C++ -> 编辑器 -> 语法高亮 -> 代码 -> 其他将前景色更改为黑色。
At least now I can see it. Anyone know how/where to change the background color for those blocks?
至少现在我能看到它。任何人都知道如何/在哪里更改这些块的背景颜色?
Thanks!
谢谢!
回答by Pawe? Iwaneczko
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
我也在寻找写发生背景。我建议每个人也将“测试为”更改为“虚线框”:首选项 -> 常规 -> 编辑器 -> 文本编辑器 -> 注释 -> C/C+ 写入事件