Eclipse 主题 - 如何更改主编辑器文本的颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20594188/
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
Eclipse Theme - How to change the color of the main editor text
提问by Inversus
To be clear, I am specifically looking for a way to change the text that is produced in the main editor as I am typing it (ie, it is black right now). For lack of a better term, I shall refer to this as 'typing text'. The version of Eclipse that I'm using is Kepler (4.3).
明确地说,我正在寻找一种方法来更改主编辑器中在我键入时生成的文本(即,它现在是黑色的)。由于缺乏更好的术语,我将其称为“输入文本”。我使用的 Eclipse 版本是 Kepler (4.3)。
The equivalent functionality can be achieved in Aptana by visiting:
通过访问以下内容,可以在 Aptana 中实现等效功能:
Window => Preferences => General => Editors => Text Editors
and changing the Foreground Color
并改变 Foreground Color
Now, eclipse actually has this same setting, but it doesn't seem to do anything. It is possible that it is getting overridden by the styles applied through the Moonrise theme, which I found out about elsewhere on StackOverflow and have installed.
现在,eclipse 实际上具有相同的设置,但它似乎没有做任何事情。它可能会被通过 Moonrise 主题应用的样式覆盖,我在 StackOverflow 的其他地方发现并安装了它。
I have determined that a lot of eclipse's fonts/colors/etc can be edited through the Moonrise CSS files, but have not been able to find a style that affects the typing text.
我已经确定了很多 eclipse 的字体/颜色/等都可以通过 Moonrise CSS 文件进行编辑,但是一直无法找到影响输入文本的样式。
So I am looking for any way to change the color of this so-called 'typing text' that is likely (but not limited) to be one of the following:
所以我正在寻找任何方法来改变这个所谓的“输入文本”的颜色,它可能(但不限于)是以下之一:
- A setting in one of eclipse's many locations (See list below)
- Some MoonRise CSS tweak
- Some other CSS tweak that works (through MoonRise's CSS, I'd imagine)
- 日食众多地点之一的设置(请参阅下面的列表)
- 一些 MoonRise CSS 调整
- 其他一些有效的 CSS 调整(通过 MoonRise 的 CSS,我想)
"Why?" You might ask?
“为什么?” 你可能会问?
Imagine handwriting with a pen that used molten metal as ink that would dry in various colors as you completed words. That, but for code. Oh yes.
想象一下用钢笔书写,这种钢笔使用熔融金属作为墨水,当你完成单词时,墨水会变干成各种颜色。那,但对于代码。哦是的。
Editing Moonrise's CSS files:
编辑 Moonrise 的 CSS 文件:
Here is Moonrise's page on GitHub
Or just install it directly through eclipse (as I did):
或者直接通过 eclipse 安装它(就像我一样):
https://raw.github.com/guari/eclipse-ui-theme/master/com.github.eclipseuitheme.themes.updatesite
After installing Moonrise, go to:
安装 Moonrise 后,转到:
Window => Preferences => General => Appearance
and set the Theme
to MoonRise (standalone)
并设置Theme
为MoonRise (standalone)
Make a backup copy of, and open in WinRAR (or similar), the following JAR file (obviously, your version number may differ):
备份并在 WinRAR(或类似)中打开以下 JAR 文件(显然,您的版本号可能不同):
{pathToEclipse}eclipse/plugins/com.github.eclipseuitheme.themes.moonrise-ui_0.8.4.jar
Open the file (inside the jar):
打开文件(在 jar 内):
themes/css/moonrise-ui-standalone.css
Then you can play around thusly:
然后你可以这样玩:
- Edit a CSS rule
- Save the file
- WinRAR will ask if you want to update the archive
- Ensure Eclipse is closed.
- Click WinRAR's
Yes
button. - Open Eclipse
- Survey the damage
- Rinse, repeat.
- 编辑 CSS 规则
- 保存文件
- WinRAR 会询问您是否要更新存档
- 确保 Eclipse 已关闭。
- 单击 WinRAR 的
Yes
按钮。 - 打开日食
- 调查损害
- 冲洗,重复。
Eclipse Color Locations:
Eclipse 颜色位置:
Since it is a serious pain keeping track of which color is where in the Eclipse Preferences, I made this list of all the sections in which there are color changing options. Note that various plugins and libraries will have their own sections included in Preferences. Obviously, this is not an exhaustive list of those, but I do believe that it's an exhaustive list of the Eclipse ones. Please comment if you know any more not listed (besides some library/plug-in or another).
由于跟踪 Eclipse Preferences 中的颜色是一个严重的痛苦,我列出了所有有颜色更改选项的部分。请注意,各种插件和库将在首选项中包含自己的部分。显然,这不是一个详尽的列表,但我相信它是一个详尽的 Eclipse 列表。如果您知道更多未列出的内容(除了一些库/插件或其他),请发表评论。
- General => Appearance => Colors and Fonts
- General => Compare/Patch => Text Compare (tab)
- General => Editors => Structured Text Editors
- General => Editors => Text Editors
- General => Editors => Text Editors => Annotations
- General => Editors => Text Editors => Linked Mode
- General => Editors => Text Editors => Quick Diff
- General => Editors => Text Editors => WikiText
- General => Editors => Text Editors => WikiText => Appearance
- General => Search
- Java => Editor
- Java => Editor => Syntax Coloring
- Java => Properties Files Editors
- Mwe2 => Syntax Coloring
- Plug-in Development => Editors
- Run/Debug
- Run/Debug => Console
- XML => XML Files => Editor => Syntax Coloring
- Xtend => Syntax Coloring
- Xtext => Syntax Coloring
- 一般 => 外观 => 颜色和字体
- 常规 => 比较/补丁 => 文本比较(选项卡)
- 一般 => 编辑器 => 结构化文本编辑器
- 一般 => 编辑器 => 文本编辑器
- 一般 => 编辑器 => 文本编辑器 => 注释
- 一般 => 编辑器 => 文本编辑器 => 链接模式
- 一般 => 编辑器 => 文本编辑器 => 快速差异
- 一般 => 编辑器 => 文本编辑器 => WikiText
- 一般 => 编辑器 => 文本编辑器 => WikiText => 外观
- 一般 => 搜索
- Java => 编辑器
- Java => 编辑器 => 语法着色
- Java => 属性文件编辑器
- Mwe2 => 语法着色
- 插件开发 => 编辑器
- 运行/调试
- 运行/调试 => 控制台
- XML => XML 文件 => 编辑器 => 语法着色
- Xtend => 语法着色
- Xtext => 语法着色
Solution:
解决方案:
After much searching, I've found a place to change the typing color. It turns out that the color can be changed through the Preferences window:
经过多次搜索,我找到了一个可以更改打字颜色的地方。原来可以通过 Preferences 窗口更改颜色:
Eclipse => Window => Preferences => Java => Editor => Syntax Coloring => Element => Java => Others
Additionally, a big piece of the puzzle that I was missing is the Plug-In Selection Spy
which allows for determining the theming information about a specific UI element. It can be viewed by selecting a UI element and pressing ALT+SHIFT+F1
此外,我遗漏的一大难题是Plug-In Selection Spy
它允许确定有关特定 UI 元素的主题信息。可以通过选择一个 UI 元素并按ALT+SHIFT+F1
This was brought to my attention in the answer that was accepted for this information and an explanation of why the Foreground
color wasn't being applied.
我在此信息接受的答案中引起了我的注意,并解释了为什么Foreground
没有应用颜色。
I then set out to learn more about this sacred tool and found this great tutorial, which I'll leave here for anyone else who has similar issues in the future.
然后我开始学习更多关于这个神圣工具的信息,并找到了这个很棒的教程,我会把它留在这里给将来遇到类似问题的其他人。
采纳答案by greg-449
The lines
线条
StyledText {
background-color: #383C3E;
color: #dddddd;
}
in the moonrise-ui-standalone.css
file set the colors for the plain text editor. Given the large number of more specific styles in the CSS file this might vary for other editors.
在moonrise-ui-standalone.css
文件中设置纯文本编辑器的颜色。鉴于 CSS 文件中有大量更具体的样式,其他编辑器可能会有所不同。
回答by Inversus
After much searching, I've found a place to change the typing color. It turns out that the color can be changed through the Preferences window:
经过多次搜索,我找到了一个可以更改打字颜色的地方。原来可以通过 Preferences 窗口更改颜色:
Eclipse => Window => Preferences => Java => Editor => Syntax Coloring => Element => Java => Others