您的位置:首页 > 编程语言 > Java开发

eclipse和myeclipse修改背景色

2017-01-10 15:24 435 查看
最近没事弄着玩,想修改eclipse(myeclipse相同)背景色,毕竟经常面对代码,修改一个不是很刺眼的颜色,首先我修改成dark了,不错,但是看久了感觉太不舒服了,太黑了(至于怎么修改成dark我就不提了,网上的办法基本都可行,实在不会可以给我留言),我现在主要说一下,修改代码区和代码区之外的背景色,网上说的用eclipse插件只能修改代码区的背景色,而package explorer区以及外侧边框的背景色不能修改,搞得颜色不统一,不好看,先上图看效果:

1,都是灰色,保护眼睛

p


其实可随意设置颜色,只要你喜欢。

具体办法,只需要替换css即可:

1,先window-->preferences-->general-->appearance-->theme选择windows classic即可;

2,找到eclipse的安装路径:D:\eclipse\eclipse-jee-mars-1-win32-x86_64\eclipse\plugins\org.eclipse.ui.themes_1.1.0.v20150511-0913\css下的e4_classic_win7.css将我下面的内容全部复制粘贴替换即可:

/*******************************************************************************

 * Copyright (c) 2010, 2014 IBM Corporation and others.

 * All rights reserved. This program and the accompanying materials

 * are made available under the terms of the Eclipse Public License v1.0

 * which accompanies this distribution, and is available at

 * http://www.eclipse.org/legal/epl-v10.html
 *

 * Contributors:

 *     IBM Corporation - initial API and implementation

 *     Lars Vogel <Lars.Vogel@gmail.com> - Bug 420836

 *******************************************************************************/

.MPart.busy {
font-style: italic;

}

.MPart.highlighted {
font-weight: bold;

}

.MPartStack, .MPart {
font-family: '#org-eclipse-ui-workbench-TAB_TEXT_FONT';

}

CTabItem:selected {
color: '#org-eclipse-ui-workbench-ACTIVE_TAB_TEXT_COLOR';/*当前tab页标题字体颜色*/

}

.MTrimmedWindow {
margin-top: 0px;
margin-bottom: 0px;
margin-left: 2px;
margin-right: 2px;

}

.MPartStack {
swt-tab-renderer: null;
swt-selected-tabs-background: '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END' 100%;
swt-simple: false;
swt-mru-visible: true;
color: '#org-eclipse-ui-workbench-INACTIVE_TAB_TEXT_COLOR';

}

.MPartStack.active {
swt-selected-tabs-background: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END' 100%;

}

.MPartStack.active.noFocus {
swt-selected-tabs-background: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_START' '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_BG_END' 100%;

}

.MPartStack.active.noFocus > CTabItem:selected {
color: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_TEXT_COLOR';

}

#PerspectiveSwitcher  {
eclipse-perspective-keyline-color: #ECE9D8 #FFFFFF;

}

.MToolControl.TrimStack {
frame-image:  url(./winClassicTSFrame.png);
handle-image:  url(./winClassicHandle.png);
frame-cuts: 5px 1px 5px 16px;

}

.MToolBar.Draggable {
handle-image:  url(./dragHandle.png);

}

.MToolControl.Draggable
4000
{
handle-image:  url(./dragHandle.png);

}

.DragFeedback {
background-color: COLOR-WIDGET-NORMAL-SHADOW;

}

.ModifiedDragFeedback {
background-color: #A0A000;

}

#org-eclipse-ui-editorss {
swt-tab-height: 8px;

}

/*******************************************************************************

 * 从这以下可以修改eclipse背景色

 *******************************************************************************/

IEclipsePreferences#org-eclipse-ui-editors {
preferences:
'AbstractTextEditor.Color.Background=192,220,192'/*editors背景色*/

}

Composite, ScrolledComposite, ExpandableComposite, TabFolder, CLabel, Label,

ToolItem, Sash, Group, Hyperlink, RefactoringLocationControl, Link, FilteredTree,

ProxyEntriesComposite, NonProxyHostsComposite, DelayedFilterCheckboxTree,

Splitter, ScrolledPageContent, ViewForm, LaunchConfigurationFilteredTree,

ContainerSelectionGroup, BrowseCatalogItem, EncodingSettings,

ProgressMonitorPart, DocCommentOwnerComposite, NewServerComposite,

NewManualServerComposite, ServerTypeComposite, FigureCanvas,

DependenciesComposite, ListEditorComposite, WrappedPageBook,

CompareStructureViewerSwitchingPane, CompareContentViewerSwitchingPane,

QualifiedNameComponent, RefactoringStatusViewer, ImageHyperlink,

Button /* SWT-BUG: checkbox inner label font color is not accessible */,

ViewForm > ToolBar, /* SWT-BUG: ToolBar do not inherit rules from ViewForm */

/*Shell [style~='SWT.DROP_DOWN'] > GradientCanvas,*/ /* ignored */

/* SWT-BUG dirty workaround [Eclipse Bug 419482]: a generic rule (eg: Composite > *) needed to catch an

   element without a CSS id, a CSS class and a seekable Widget name, cannot be overridden

   by a subsequent more specific rule used to correct the style for seekable elements (<1>): */

TabFolder > Composite > *, /* Composite > CommitSearchPage$... */

TabFolder > Composite > * > * /* [style~='SWT.NO_BACKGROUND'] <- generate E4 non-sense bugs in apparently not related other rules */, /* Composite > ContentMergeViewer$... > TextMergeViewer$... */

DocCommentOwnerComposite > Group > *, /* Group > DocCommentOwnerComposite$... */

TabFolder > Composite > ScrolledComposite > *, /* ScrolledComposite > ControlListViewer$... */

Shell > Composite > Composite > *, /* Composite > StatusDialog$MessageLine (SWT-BUG: ignored) */

Composite > Composite > Composite > ToolBar, /* Window->Preference (top toolbar) */

Composite > Composite > Composite > Group > *, /* Group > CreateRefactoringScriptWizardPage$... */

Shell > Composite > Composite > Composite > *, /* Composite > FilteredPreferenceDialog$... */

ScrolledComposite > Composite > Composite > Composite > *, /* Composite > NewKeysPreferencePage$... */

Shell > Composite > Composite > Composite > Composite > Composite > *, /* Composite > ShowRefactoringHistoryWizardPage$... */

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > *, /* Composite > RefactoringWizardDialog$...
*/

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > * > * /* Composite > RefactoringWizardDialog$...
*/ {

    background-color:#C0DCC0;/*工具栏颜色*/

    color:#000000;/*控制面板等tab页字体颜色*/

}

Tree,

RegistryFilteredTree,

/* the following are required due to Bug 419482 (see <1>): */

Composite > Tree,

TabFolder > Composite > Tree,

TabFolder > Composite > * > Tree,

DocCommentOwnerComposite > Group > Tree,

TabFolder > Composite > ScrolledComposite > Tree,

Shell > Composite > Composite > Tree,

Composite > Composite > Composite > Group > Tree,

Shell > Composite > Composite > Composite > Tree,

ScrolledComposite > Composite > Composite > Composite > Tree,

Shell > Composite > Composite > Composite > Composite > Composite > Tree,

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > Tree,

Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][style~='SWT.SHADOW_ETCHED_OUT'][style~='SWT.RESIZE'][style~='SWT.MENU'][style~='SWT.FULL_SELECTION'][style~='SWT.DATE'] > Composite > * > Tree {

    background-color: #C0DCC0;/*除代码面板外所有面板背景色*/

    color: #000000;/*字体颜色*/
font-size: 12px;/*字体大小*/
font-family: "Consolas";/*字体,根据个人需要修改*/

}

/*下边是控制台背景色和字体颜色,每一段都可以起作用,具体有什么区别没有仔细研究*/

#org-eclipse-ui-console-ConsoleView .MPart > Composite,

#org-eclipse-ui-console-ConsoleView .MPart StyledText,

#org-eclipse-ui-console-ConsoleView .MPart PageBook Label,

#org-eclipse-dltk-debug-ui-ScriptDisplayView SashForm > * {

    background-color: #C0DCC0;

    color: #CCCCCC;
font-size: 16px;
font-family: "Consolas";

}

.MPartStack.active #org-eclipse-ui-console-ConsoleView .MPart > Composite,

.MPartStack.active #org-eclipse-ui-console-ConsoleView .MPart StyledText,

.MPartStack.active #org-eclipse-ui-console-ConsoleView .MPart PageBook Label,

.MPartStack.active #org-eclipse-dltk-debug-ui-ScriptDisplayView SashForm > * {

    background-color: #C0DCC0;

    color: #CCCCCC;
font-size: 16px;
font-family: "Consolas";

},

3,重启eclipse就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: