How to set font and colors of Eclipse UI

The original URL of this article is https://codeyarns.com/2014/11/03/how-to-set-font-and-font-size-of-eclipse-ui/

 Qestion: How to change the icon's color of three view? (That's the color of > before a item of project view.)

 

The font, font size and colors of most of the UI elements of Eclipse can be changed. Some of them can be set from inside Eclipse, others can be set in the CSS files used by the current Eclipse theme. There are other elements which can be changed only by modifying the settings of the current GTK or GNOME theme.

Inside Eclipse

Based on the current theme that Eclipse is using, many of the settings are in CSS files.

  • Font and fonts sizes of editor, console, dialog and other UI elements can be changed from Window -> Preferences -> General -> Appearance -> Colors and Fonts.

However, you will find that the font and font sizes of Project Explorer, Outline, Problems, Make and many other UI windows which hold tree-like elements cannot be changed from here. To do that you need to modify the CSS file of the theme you are current using. Here is how to do that:

  • Find out what is the current theme that Eclipse is using. You can see that in Window -> Preferences -> General -> Appearance. For example, I found that mine was using the theme GTK and the Color and Font theme was Default.

     

  • Go to the install directory of Eclipse and go to the themes CSS directory. For example, on my system this was plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css.

  • Open the CSS file that corresponds to the theme that Eclipse is currently using. For example, for my theme I found the file e4_default_gtk.css.

  • Add this CSS style to change the font and font size. For example, to set to font Arial with size 8, I would add:

1
2
3
4
.MPart Tree {
    font-family: Consolas;
    font-size: 8;
}
  • Close the file. Close Eclipse and open it back again. You should be able to see the change in Project Explorer, Outline, and other windows that have tree-like UI elements.

Outside Eclipse

posted @ 2019-04-24 16:40  耕读编码  阅读(156)  评论(0编辑  收藏  举报