Ubuntu + Eclipse 4.2 - 深色主题 - 如何使侧边栏背景变暗? [英] Ubuntu + Eclipse 4.2 - Dark theme - How to darken sidebar backgrounds?

查看:16
本文介绍了Ubuntu + Eclipse 4.2 - 深色主题 - 如何使侧边栏背景变暗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于在计算机屏幕前进行 24/7 编程(工作、论文),因此尽可能多地查看深色是有益的.

Ubuntu 的 Ambiance 主题可以使用 Solancer 的定制化 和 Eclipse Juno 在应用 后看起来基本一致Roger Dudler 的黑暗朱诺主题.

但是,使用像 Dudler 这样的深色 Juno 主题存在问题.Package ExplorerProject Explorer 和其他 Eclipse 视图中(in)活动元素的背景颜色显示白色/灰色,这不仅不一致,而且实际上掩盖了重要的显示组件像扩展箭头.

经过多次谷歌搜索后,这些颜色似乎是从操作系统继承的,因此无法从 Eclipse Preferences 中更改.我希望深色 GTK 3/Unity 主题(Solancer's Ambiance)能够提供必要的深色,但事实并非如此.

我已经使用 sed 替换了 all 中的 all 预定义颜色,/opt/eclipse/plugins 下的 .css 文件/org.eclipse.platform_4.2.0.v*/css#FF0000 以确定那里定义的任何颜色是否会影响白色/灰色问题颜色;遗憾的是他们没有.

在网上看到提到一个 ~/.e4css 文件夹,其中可能包含这些属性的覆盖 CSS 定义,我在本地机器上寻找该文件夹,却发现它不存在.

SO 上存在与此类似的问题,但没有明确说明如何修复"这些颜色.

我的问题很简单:是否有一个 GTK+ 3.0 CSS 属性(组)可以定义为 Eclipse 4.x 指定这些颜色,应该在哪里配置?

解决方案

最后自己手动搜索GTK配置文件找到解决方案.

事实证明 Eclipse 使用 GTK+ 2.0.

如果您在 Ubuntu 中安装自定义 GTK 主题(所有这些都与 Unity 兼容),您会将主题文件夹解压缩到 ~/.themes.

GTK+ 3.0 是通过 css 配置的,例如~/.themes/YourTheme/gtk-3.0/gtk.css

GTK+ 2.0 是通过 rc 文件配置的,例如~/.themes/YourTheme/gtk-2.0/gtkrc

由于许多应用程序是特定于 GTK+ 2.0 的,因此大多数 GTK+ 3.0 主题都包含这两个配置文件夹.

GTK+ 2.0 gtkrc 文件中的前导行包含基本的前景色和背景色;这些是必须改变的.

要在 Eclipse 视图中修改选定的活动元素 bg 颜色,您必须更改颜色 base_color.要修改未选中元素的背景颜色,您必须更改selected_bg_color.字体颜色使用等效的 fg_color 属性更改(在 base_color 的情况下,这只是 'fg_color').

请记住,这将影响所有 GTK 应用程序,因此您可能需要根据个人喜好进行调整.另请注意,您必须重新加载活动的 GTK 主题并重新启动 Eclipse 才能看到更改生效.执行此操作的最快方法是 sudo apt-get install myunity,在颜色更改期间重新启动 Eclipse 时启动并保持打开状态,并在每次希望加载时选择另一个主题,然后选择所需的主题您的 gtkrc 更改.

我的活动 GTK 主题中的原始 gtkrc 前导行如下:

gtk-color-scheme = "base_color:#ffffff
fg_color:#4c4c4c
tooltip_fg_color:#ffffff
selected_bg_color:#f07746
selected_fg_color:#FFFFFF
text_color:#3C3Fg_color:#3C3Fg_colorF:#000000
link_color:#DD4814"

经过多次试验,我决定采用这种替换配置:

gtk-color-scheme = "base_color:#555555
fg_color:#000000
tooltip_fg_color:#999999
selected_bg_color:#666666
selected_fg_color:#ffffff
text_3g_color0:#000000
tooltip_fg_color::#000000
link_color:#DD4814"

整个操作系统的变化非常令人愉悦!下面是 Eclipse 现在的样子,这次没有遮挡:

希望你喜欢新外观:)

附言正如您所预测的,Netbeans 的过程是等效的.

更新

这是补充信息,使用自定义主题(例如Dudler's)时,上述过程仍然正确.

经过进一步的实验,现在很清楚为什么编辑 /opt/eclipse/plugins/org.eclipse.platform_4.2.0.v*/css/*.css 没有任何效果:

假设您正在该位置编辑 e4_default_gtk.css - 只有当您在 Window 中选择 GTK 时,该文件中更改样式的效果才会应用->首选项 ->外观 ->[主题].

您可以将此下拉列表中列出的主题以及您的操作系统与上述文件系统位置中的 .css 文件的名称相关联.

Due to spending 24/7 programming in front of a computer screen (job, thesis), it's beneficial to view dark colours as much as possible.

Ubuntu's Ambiance theme can be neatly enhanced using Solancer's customisations, and Eclipse Juno looks mostly consistent after applying Roger Dudler's dark Juno theme.

However, there is a problem with using a dark Juno theme like Dudler's. The background colour of (in)active elements within Package Explorer, Project Explorer and other Eclipse views displays white/grey colours that are not only inconsistent, but actually obscures important display components like expansion arrows.

After much googling, it seems such colours are inherited from the OS, and therefore cannot be changed from within Eclipse Preferences. I'd hoped that the dark GTK 3 / Unity theme (Solancer's Ambiance) would supply the necessary dark colours, but this is not the case.

I've used sed to replace all predefined colours in all the .css files under /opt/eclipse/plugins/org.eclipse.platform_4.2.0.v*/css with #FF0000 to establish whether any colours defined there affect the white/grey problem colours; sadly they do not.

Having seen mention of a ~/.e4css folder online which may contain overriding CSS definitions for such properties, I sought the folder on my local machine, only to find it does not exist.

Similar questions to this exist on SO, yet none explicitly specify how to "fix" these colours.

My question is simple: is there a GTK+ 3.0 CSS property (group) that can be defined to specify these colours for Eclipse 4.x, and where should it be configured?

解决方案

Finally found the solution through searching GTK configuration files manually myself.

It turns out Eclipse uses GTK+ 2.0 .

If you install a custom GTK theme in Ubuntu (all are compatible with Unity too) you'll extract the theme folder into ~/.themes.

GTK+ 3.0 is configured via css, e.g. ~/.themes/YourTheme/gtk-3.0/gtk.css

GTK+ 2.0 is configured via an rc file, e.g. ~/.themes/YourTheme/gtk-2.0/gtkrc

Most GTK+ 3.0 themes contain both of these configuration folders due to many applications being GTK+ 2.0 specific.

The leading line in the GTK+ 2.0 gtkrc file contains fundamental foreground and background colours; these are what must be changed.

To modify the selected, active element bg colour in Eclipse views you must change colour base_color. To modify the unselected element bg colour, you must change selected_bg_color. Font colour is changed with the equivalent fg_color properties (in the case of base_color this is simply 'fg_color').

Bear in mind this will affect all GTK applications, so you may need to tweak according to personal taste. Also note that you must reload the active GTK theme and restart Eclipse to see changes in effect. The quickest way to do this is to sudo apt-get install myunity, launch and leave it open while you restart Eclipse during colour changes, and select another theme followed by your desired theme each time you wish to load your gtkrc changes.

The original gtkrc leading line in my active GTK theme read:

gtk-color-scheme = "base_color:#ffffff
fg_color:#4c4c4c
tooltip_fg_color:#ffffff
selected_bg_color:#f07746
selected_fg_color:#FFFFFF
text_color:#3C3C3C
bg_color:#F2F1F0
tooltip_bg_color:#000000
link_color:#DD4814"

After much experimentation I settled on this replacement configuration:

gtk-color-scheme = "base_color:#555555
fg_color:#000000
tooltip_fg_color:#999999
selected_bg_color:#666666
selected_fg_color:#ffffff
text_color:#000000
bg_color:#333333
tooltip_bg_color:#000000
link_color:#DD4814"

The change across the entire OS is very pleasing! Here's how Eclipse looks now, no obscuring this time:

Hope you like the new look :)

P.S. As you'd predict, the process for Netbeans is equivalent.

UPDATE

This is supplementary info, the above process is still correct when using a custom theme such as Dudler's.

After further experimentation it's now clear why editing /opt/eclipse/plugins/org.eclipse.platform_4.2.0.v*/css/*.css didn't have any effect:

Let's say you're editing e4_default_gtk.css in that location - the effects of changed styles in that file will only apply when you select GTK in Window -> Preferences -> Appearance -> [Theme].

You can relate the themes listed in this dropdown, along with your Operating System, to the names of the .css files in the aforementioned filesystem location.

这篇关于Ubuntu + Eclipse 4.2 - 深色主题 - 如何使侧边栏背景变暗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆