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 62622 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]
Initial patch implementing Kelvin's rules
patch180415.txt (text/plain), 8.80 KB, created by
Kevin McGuire
on 2007-04-01 23:45:11 EDT
(
hide
)
Description:
Initial patch implementing Kelvin's rules
Filename:
MIME Type:
Creator:
Kevin McGuire
Created:
2007-04-01 23:45:11 EDT
Size:
8.80 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 2 Apr 2007 03:44:00 -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,14 +1212,10 @@ > value="COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT"> > </colorValue> > <colorFactory >- class="org.eclipse.ui.internal.themes.DarkColorSelectionFactory" >+ class="org.eclipse.ui.internal.themes.KelvinColorsTabEnd" > plugin="org.eclipse.ui"> > <parameter >- name="color1" >- value="COLOR_TITLE_BACKGROUND_GRADIENT"> >- </parameter> >- <parameter >- name="color2" >+ name="base" > value="COLOR_TITLE_BACKGROUND"> > </parameter> > </colorFactory> >@@ -1236,16 +1232,12 @@ > value="COLOR_TITLE_INACTIVE_BACKGROUND"> > </colorValue> > <colorFactory >- class="org.eclipse.ui.internal.themes.LightColorSelectionFactory" >+ class="org.eclipse.ui.internal.themes.KelvinColorsTabBegin" > plugin="org.eclipse.ui"> >- <parameter >- name="color1" >- value="COLOR_TITLE_BACKGROUND_GRADIENT"> >- </parameter> >- <parameter >- name="color2" >+ <parameter >+ name="base" > value="COLOR_TITLE_BACKGROUND"> >- </parameter> >+ </parameter> > </colorFactory> > </colorDefinition> > <!-- Active (Nofocus) Tab Colors --> >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabBegin.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabBegin.java >diff -N Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabBegin.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabBegin.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * 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; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class KelvinColorsTabBegin extends KelvinColorsTabEnd { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.themes.IColorFactory#createColor() >+ */ >+ public RGB createColor() { >+ if (baseColorName == null) >+ return new RGB(0, 0, 0); >+ RGB base = super.createColor(); >+ return blend(75, white, base); >+ } >+ >+} >Index: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabEnd.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabEnd.java >diff -N Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabEnd.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/themes/KelvinColorsTabEnd.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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; >+import org.eclipse.ui.themes.ColorUtil; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class KelvinColorsTabEnd extends KelvinColorFactory { >+ /* >+ * 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, 181, 255) >= 2) >+ return sample; >+ >+ //Group 2 >+ if(valuesInRange(sample, 100, 180) >= 2) >+ return blend(30, white, sample); >+ >+ //Group 3 >+ if(valuesInRange(sample, 0, 99) >= 2) >+ return blend(60, white, sample); >+ >+ //Group 4 >+ return blend(30, white, sample); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.themes.IColorFactory#createColor() >+ */ >+ public RGB createColor() { >+ if (baseColorName == null) >+ return new RGB(0, 0, 0); >+ return getLightenedColor( >+ ColorUtil.getColorValue(baseColorName)); >+ } >+} >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,82 @@ >+/******************************************************************************* >+ * 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.IColorFactory; >+ >+/** >+ * ColorSelectionFactory is the abstract superclass of factories that compare >+ * two colors. >+ * >+ * @since 3.3 >+ * >+ */ >+public abstract class KelvinColorFactory implements IColorFactory, >+ IExecutableExtension { >+ >+ protected static final RGB white = new RGB(255, 255, 255); >+ >+ String baseColorName; >+ >+ /** >+ * This executable extension requires parameters to be explicitly declared >+ * via the second method described in the <code>IExecutableExtension</code> >+ * documentation. This class expects that there will be one parameter, >+ * <code>base</code>, that describes the base color to produce all other colours from. >+ * This value may either be an RGB triple or an SWT constant. >+ * >+ * @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; >+ baseColorName = (String) table.get("base"); //$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 an RGB value that is a blend of prop/100 of color1 and >+ * 100-prop of color2. >+ */ >+ protected RGB blend(int prop1, RGB color1, RGB color2) { >+ int prop2 = 100 - prop1; >+ return new RGB( >+ (color1.red * prop1 / 100) + (color2.red * prop2 / 100), >+ (color1.green * prop1 / 100) + (color2.green * prop2 / 100), >+ (color1.blue * prop1 / 100) + (color2.blue * prop2 / 100) >+ ); >+ } >+ >+ >+ >+}
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