Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 180415 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-15 / +7 lines)
Lines 1189-1195 Link Here
1189
      <colorDefinition
1189
      <colorDefinition
1190
            label="%Color.activeTabText"
1190
            label="%Color.activeTabText"
1191
            categoryId="org.eclipse.ui.presentation.default"
1191
            categoryId="org.eclipse.ui.presentation.default"
1192
            value="COLOR_TITLE_FOREGROUND"
1192
            value="COLOR_WIDGET_FOREGROUND"
1193
            id="org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR">
1193
            id="org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR">
1194
         <description>
1194
         <description>
1195
            %Color.activeTabTextDesc
1195
            %Color.activeTabTextDesc
Lines 1212-1225 Link Here
1212
               value="COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT">
1212
               value="COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT">
1213
         </colorValue>
1213
         </colorValue>
1214
         <colorFactory
1214
         <colorFactory
1215
               class="org.eclipse.ui.internal.themes.DarkColorSelectionFactory"
1215
               class="org.eclipse.ui.internal.themes.KelvinColorsTabEnd"
1216
               plugin="org.eclipse.ui">
1216
               plugin="org.eclipse.ui">
1217
          <parameter
1217
          <parameter
1218
                  name="color1"
1218
                  name="base"
1219
                  value="COLOR_TITLE_BACKGROUND_GRADIENT">
1220
          </parameter>
1221
          <parameter
1222
                  name="color2"
1223
                  value="COLOR_TITLE_BACKGROUND">
1219
                  value="COLOR_TITLE_BACKGROUND">
1224
          </parameter>
1220
          </parameter>
1225
         </colorFactory>
1221
         </colorFactory>
Lines 1236-1251 Link Here
1236
               value="COLOR_TITLE_INACTIVE_BACKGROUND">
1232
               value="COLOR_TITLE_INACTIVE_BACKGROUND">
1237
         </colorValue>
1233
         </colorValue>
1238
         <colorFactory
1234
         <colorFactory
1239
               class="org.eclipse.ui.internal.themes.LightColorSelectionFactory"
1235
               class="org.eclipse.ui.internal.themes.KelvinColorsTabBegin"
1240
               plugin="org.eclipse.ui">
1236
               plugin="org.eclipse.ui">
1241
            <parameter
1237
          <parameter
1242
                  name="color1"
1238
                  name="base"
1243
                  value="COLOR_TITLE_BACKGROUND_GRADIENT">
1244
            </parameter>
1245
            <parameter
1246
                  name="color2"
1247
                  value="COLOR_TITLE_BACKGROUND">
1239
                  value="COLOR_TITLE_BACKGROUND">
1248
            </parameter>
1240
          </parameter>
1249
         </colorFactory>
1241
         </colorFactory>
1250
      </colorDefinition>
1242
      </colorDefinition>
1251
<!-- Active (Nofocus) Tab Colors -->
1243
<!-- Active (Nofocus) Tab Colors -->
(-)Eclipse (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.ui.internal.themes;
13
14
import org.eclipse.swt.graphics.RGB;
15
16
/**
17
 * @since 3.3
18
 *
19
 */
20
public class KelvinColorsTabBegin extends KelvinColorsTabEnd {
21
22
	/*
23
	 * (non-Javadoc)
24
	 * 
25
	 * @see org.eclipse.ui.themes.IColorFactory#createColor()
26
	 */
27
	public RGB createColor() {
28
		if (baseColorName == null) 
29
			return new RGB(0, 0, 0);
30
		RGB base = super.createColor();
31
		return blend(75, white, base);
32
	}
33
34
}
(-)Eclipse (+54 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.ui.internal.themes;
13
14
import org.eclipse.swt.graphics.RGB;
15
import org.eclipse.ui.themes.ColorUtil;
16
17
/**
18
 * @since 3.3
19
 *
20
 */
21
public class KelvinColorsTabEnd extends KelvinColorFactory {
22
	/*
23
	 * Return the RGB value for the bottom tab color
24
	 * based on a blend of white and sample color
25
	 */
26
	private RGB getLightenedColor(RGB sample) {
27
		//Group 1
28
		if(valuesInRange(sample, 181, 255) >= 2)
29
			return sample;
30
		
31
		//Group 2
32
		if(valuesInRange(sample, 100, 180) >= 2)
33
			return blend(30, white, sample);
34
		
35
		//Group 3
36
		if(valuesInRange(sample, 0, 99) >= 2)
37
			return blend(60, white, sample);
38
		
39
		//Group 4
40
		return blend(30, white, sample);
41
	}
42
43
	/*
44
	 * (non-Javadoc)
45
	 * 
46
	 * @see org.eclipse.ui.themes.IColorFactory#createColor()
47
	 */
48
	public RGB createColor() {
49
		if (baseColorName == null) 
50
			return new RGB(0, 0, 0);
51
		return getLightenedColor(
52
				ColorUtil.getColorValue(baseColorName));
53
	}
54
}
(-)Eclipse (+82 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.ui.internal.themes;
13
14
import java.util.Hashtable;
15
16
import org.eclipse.core.runtime.IConfigurationElement;
17
import org.eclipse.core.runtime.IExecutableExtension;
18
import org.eclipse.swt.graphics.RGB;
19
import org.eclipse.ui.themes.IColorFactory;
20
21
/**
22
 * ColorSelectionFactory is the abstract superclass of factories that compare
23
 * two colors.
24
 * 
25
 * @since 3.3
26
 * 
27
 */
28
public abstract class KelvinColorFactory implements IColorFactory,
29
		IExecutableExtension {
30
31
	protected static final RGB white = new RGB(255, 255, 255);
32
	
33
	String baseColorName;
34
35
	/**
36
	 * This executable extension requires parameters to be explicitly declared
37
	 * via the second method described in the <code>IExecutableExtension</code>
38
	 * documentation. This class expects that there will be one parameter,
39
	 * <code>base</code>, that describes the base color to produce all other colours from.
40
	 * This value may either be an RGB triple or an SWT constant.
41
	 * 
42
	 * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
43
	 *      java.lang.String, java.lang.Object)
44
	 */
45
	public void setInitializationData(IConfigurationElement config,
46
			String propertyName, Object data) {
47
48
		if (data instanceof Hashtable) {
49
			Hashtable table = (Hashtable) data;
50
			baseColorName = (String) table.get("base"); //$NON-NLS-1$
51
		}
52
	}
53
54
	/* 
55
	 * Return the number of RGB values in test that are
56
	 * equal to or between lower and upper.
57
	 */
58
	protected int valuesInRange(RGB test, int lower, int upper) {
59
		int hits = 0;
60
		if(test.red >= lower && test.red <= upper) hits++;
61
		if(test.blue >= lower && test.blue <= upper) hits++;
62
		if(test.green >= lower && test.green <= upper) hits++;
63
64
		return hits;
65
	}
66
67
	/*
68
	 * Return an RGB value that is a blend of prop/100 of color1 and
69
	 * 100-prop of color2.
70
	 */	
71
	protected RGB blend(int prop1, RGB color1, RGB color2) {
72
		int prop2 = 100 - prop1;
73
		return new RGB(
74
				(color1.red * prop1 / 100) + (color2.red * prop2 / 100),
75
				(color1.green * prop1 / 100) + (color2.green * prop2 / 100),
76
				(color1.blue * prop1 / 100) + (color2.blue * prop2 / 100)
77
			);
78
	}
79
80
81
82
}

Return to bug 180415