Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63093 Details for
Bug 180415
Implement "Kelvin Colours"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Complete patch for Kelvin colours
patch180415.txt (text/plain), 10.28 KB, created by
Kevin McGuire
on 2007-04-05 15:36:02 EDT
(
hide
)
Description:
Complete patch for Kelvin colours
Filename:
MIME Type:
Creator:
Kevin McGuire
Created:
2007-04-05 15:36:02 EDT
Size:
10.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/themes/LightColorSelectionFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/themes/LightColorSelectionFactory.java >diff -N Eclipse UI/org/eclipse/ui/internal/themes/LightColorSelectionFactory.java >--- Eclipse UI/org/eclipse/ui/internal/themes/LightColorSelectionFactory.java 21 Mar 2007 16:16:27 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,35 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 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 >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.themes; >- >-import org.eclipse.swt.graphics.RGB; >- >-/** >- * LightColorSelectionFactory is a factory that returns the lighter of two >- * {@link RGB} instances. >- * >- * @since 3.3 >- * >- */ >- >-public class LightColorSelectionFactory extends ColorSelectionFactory { >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.internal.themes.ColorSelectionFactory#compare(org.eclipse.swt.graphics.RGB, org.eclipse.swt.graphics.RGB) >- */ >- RGB compare(RGB rgb1, RGB rgb2) { >- if (difference(rgb1, rgb2) > 0) >- return rgb1; >- return rgb2; >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/themes/DarkColorSelectionFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/themes/DarkColorSelectionFactory.java >diff -N Eclipse UI/org/eclipse/ui/internal/themes/DarkColorSelectionFactory.java >--- Eclipse UI/org/eclipse/ui/internal/themes/DarkColorSelectionFactory.java 21 Mar 2007 16:16:27 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,38 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 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 >- ******************************************************************************/ >- >-package org.eclipse.ui.internal.themes; >- >-import org.eclipse.swt.graphics.RGB; >- >-/** >- * DarkColorSelectionFactory is a factory that returns the darker of two >- * {@link RGB} instances. >- * >- * @since 3.3 >- * >- */ >- >-public class DarkColorSelectionFactory extends ColorSelectionFactory { >- >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.ui.internal.themes.ColorSelectionFactory#compare(org.eclipse.swt.graphics.RGB, >- * org.eclipse.swt.graphics.RGB) >- */ >- RGB compare(RGB rgb1, RGB rgb2) { >- if (difference(rgb1, rgb2) > 0) >- return rgb2; >- return rgb1; >- } >- >-} >Index: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorFactory.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorFactory.java >diff -N Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorFactory.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorFactory.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,131 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.themes; >+ >+import java.util.Hashtable; >+ >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExecutableExtension; >+import org.eclipse.swt.graphics.RGB; >+import org.eclipse.ui.themes.ColorUtil; >+import org.eclipse.ui.themes.IColorFactory; >+ >+/** >+ * ColorSelectionFactory is the abstract superclass of factories that compare >+ * two colors. >+ * >+ * @since 3.3 >+ * >+ */ >+public class KelvinColorFactory implements IColorFactory, >+ IExecutableExtension { >+ >+ protected static final RGB white = new RGB(255, 255, 255); >+ >+ String base; >+ String definitionId; >+ >+ /** >+ * This executable extension requires parameters to be explicitly declared >+ * via the second method described in the <code>IExecutableExtension</code> >+ * documentation. The following parameters are parsed: >+ * <code>base</code>, describes the base color to produce all other colours from. >+ * This value may either be an RGB triple or an SWT constant. >+ * <code>definitionId</code>, describes the id of color we are looking for, one of >+ * "org.eclipse.ui.workbench.ACTIVE_TAB_BG_START" >+ * "org.eclipse.ui.workbench.ACTIVE_TAB_BG_END" >+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, >+ * java.lang.String, java.lang.Object) >+ */ >+ public void setInitializationData(IConfigurationElement config, >+ String propertyName, Object data) { >+ >+ if (data instanceof Hashtable) { >+ Hashtable table = (Hashtable) data; >+ base = (String) table.get("base"); //$NON-NLS-1$ >+ definitionId = (String) table.get("definitionId"); //$NON-NLS-1$ >+ } >+ } >+ >+ /* >+ * Return the number of RGB values in test that are >+ * equal to or between lower and upper. >+ */ >+ protected int valuesInRange(RGB test, int lower, int upper) { >+ int hits = 0; >+ if(test.red >= lower && test.red <= upper) hits++; >+ if(test.blue >= lower && test.blue <= upper) hits++; >+ if(test.green >= lower && test.green <= upper) hits++; >+ >+ return hits; >+ } >+ >+ /* >+ * Return the RGB value for the bottom tab color >+ * based on a blend of white and sample color >+ */ >+ private RGB getLightenedColor(RGB sample) { >+ //Group 1 >+ if(valuesInRange(sample, 180, 255) >= 2) >+ return sample; >+ >+ //Group 2 >+ if(valuesInRange(sample, 100, 179) >= 2) >+ return ColorUtil.blend(white, sample, 30); >+ >+ //Group 3 >+ if(valuesInRange(sample, 0, 99) >= 2) >+ return ColorUtil.blend(white, sample, 60); >+ >+ //Group 4 >+ return ColorUtil.blend(white, sample, 30); >+ } >+ >+ /* >+ * Return the Start (top of tab) color as an RGB >+ */ >+ private RGB createStartColor() { >+ if (base == null) >+ return new RGB(0, 0, 0); >+ RGB base = createEndColor(); >+ return ColorUtil.blend(white, base, 75); >+ } >+ >+ /* >+ * Return the End (top of tab) color as an RGB >+ */ >+ public RGB createEndColor() { >+ if (base == null) >+ return new RGB(0, 0, 0); >+ return getLightenedColor( >+ ColorUtil.getColorValue(base)); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.themes.IColorFactory#createColor() >+ */ >+ public RGB createColor() { >+ //should have base, otherwise error in the xml >+ if (base == null) >+ return white; >+ >+ if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START")) //$NON-NLS-1$ >+ return createStartColor(); >+ if (definitionId.equals("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END")) //$NON-NLS-1$ >+ return createEndColor(); >+ >+ //should be one of start or end, otherwise error in the xml >+ return white; >+ } >+} >#P org.eclipse.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/plugin.xml,v >retrieving revision 1.387 >diff -u -r1.387 plugin.xml >--- plugin.xml 21 Mar 2007 17:13:11 -0000 1.387 >+++ plugin.xml 5 Apr 2007 19:36:16 -0000 >@@ -1189,7 +1189,7 @@ > <colorDefinition > label="%Color.activeTabText" > categoryId="org.eclipse.ui.presentation.default" >- value="COLOR_TITLE_FOREGROUND" >+ value="COLOR_WIDGET_FOREGROUND" > id="org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR"> > <description> > %Color.activeTabTextDesc >@@ -1212,15 +1212,13 @@ > value="COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT"> > </colorValue> > <colorFactory >- class="org.eclipse.ui.internal.themes.DarkColorSelectionFactory" >+ class="org.eclipse.ui.internal.themes.KelvinColorFactory" > plugin="org.eclipse.ui"> > <parameter >- name="color1" >- value="COLOR_TITLE_BACKGROUND_GRADIENT"> >+ name="base" value="COLOR_TITLE_BACKGROUND"> > </parameter> > <parameter >- name="color2" >- value="COLOR_TITLE_BACKGROUND"> >+ name="definitionId" value="org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"> > </parameter> > </colorFactory> > </colorDefinition> >@@ -1236,16 +1234,14 @@ > value="COLOR_TITLE_INACTIVE_BACKGROUND"> > </colorValue> > <colorFactory >- class="org.eclipse.ui.internal.themes.LightColorSelectionFactory" >+ class="org.eclipse.ui.internal.themes.KelvinColorFactory" > plugin="org.eclipse.ui"> >- <parameter >- name="color1" >- value="COLOR_TITLE_BACKGROUND_GRADIENT"> >- </parameter> >- <parameter >- name="color2" >- value="COLOR_TITLE_BACKGROUND"> >- </parameter> >+ <parameter >+ name="base" value="COLOR_TITLE_BACKGROUND"> >+ </parameter> >+ <parameter >+ name="definitionId" value="org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"> >+ </parameter> > </colorFactory> > </colorDefinition> > <!-- Active (Nofocus) Tab Colors -->
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 180415
:
62621
|
62622
|
62623
| 63093 |
63137
|
65989