diff --git a/.gitignore b/.gitignore
index 5476be3..1432c0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,4 @@ package
/bin/
# Eclipse Core
/.settings/
-/.metadata/
-# JDT-specific (Eclipse Java Development Tools)
-.classpath
\ No newline at end of file
+/.metadata/
\ No newline at end of file
diff --git a/com.aobuchow.themes.spectrum.feature/feature.xml b/com.aobuchow.themes.spectrum.feature/feature.xml
index b40e8a1..889f224 100644
--- a/com.aobuchow.themes.spectrum.feature/feature.xml
+++ b/com.aobuchow.themes.spectrum.feature/feature.xml
@@ -26,4 +26,11 @@
version="0.0.0"
unpack="false"/>
+
+
diff --git a/com.aobuchow.themes.spectrum.preferences/.classpath b/com.aobuchow.themes.spectrum.preferences/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/com.aobuchow.themes.spectrum.preferences/.gitignore b/com.aobuchow.themes.spectrum.preferences/.gitignore
new file mode 100644
index 0000000..956c0d7
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/.gitignore
@@ -0,0 +1,5 @@
+# Maven
+/target/
+/bin/
+# Eclipse Core
+/.settings/
diff --git a/com.aobuchow.themes.spectrum.preferences/.project b/com.aobuchow.themes.spectrum.preferences/.project
new file mode 100644
index 0000000..01b9f5b
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/.project
@@ -0,0 +1,28 @@
+
+
+ com.aobuchow.themes.spectrum.preferences
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/com.aobuchow.themes.spectrum.preferences/META-INF/MANIFEST.MF b/com.aobuchow.themes.spectrum.preferences/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ca1cbe1
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Spectrum Preferences
+Bundle-SymbolicName: com.aobuchow.themes.spectrum.preferences;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: com.aobuchow.themes.spectrum.preferences.Activator
+Bundle-Vendor: aobuchow
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.swt,
+ org.eclipse.e4.core.services,
+ org.eclipse.e4.ui.model.workbench,
+ org.eclipse.e4.core.contexts,
+ org.eclipse.e4.ui.css.swt.theme,
+ org.eclipse.ui.forms;bundle-version="3.9.100"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Automatic-Module-Name: com.aobuchow.themes.spectrum.preferences
+Bundle-ActivationPolicy: lazy
+Import-Package: org.osgi.service.event;version="1.4.0"
diff --git a/com.aobuchow.themes.spectrum.preferences/build.properties b/com.aobuchow.themes.spectrum.preferences/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/com.aobuchow.themes.spectrum.preferences/plugin.xml b/com.aobuchow.themes.spectrum.preferences/plugin.xml
new file mode 100644
index 0000000..972ecf5
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/plugin.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Activator.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Activator.java
new file mode 100644
index 0000000..32d60b9
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Activator.java
@@ -0,0 +1,55 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.aobuchow.themes.spectrum.preferences"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ private ColorManager colorManager;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ colorManager = new ColorManager();
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ colorManager.dispose();
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @return the colorManager
+ */
+ public ColorManager getColorManager() {
+ return colorManager;
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/BrowserUtils.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/BrowserUtils.java
new file mode 100644
index 0000000..5751bed
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/BrowserUtils.java
@@ -0,0 +1,25 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+
+public final class BrowserUtils {
+
+ public static void openUrl(String category, String url) {
+ try {
+ IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
+ .createBrowser("spectrum.browser." + category);
+ browser.openURL(new URL(url));
+ } catch (PartInitException | MalformedURLException e) {
+ final Status status = new Status(IStatus.ERROR, BrowserUtils.class, "Cannot open URL '" + url + "'", e);
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorHSL.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorHSL.java
new file mode 100644
index 0000000..5ef7743
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorHSL.java
@@ -0,0 +1,156 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.PlatformUI;
+
+public class ColorHSL {
+ private Color color;
+ private float hue;
+ private float saturation;
+ private float luminance;
+
+ public ColorHSL(Color color) {
+ this.color = color;
+ this.hue = color.getRGB().getHSB()[0];
+ this.saturation = color.getRGB().getHSB()[1];
+ this.luminance = color.getRGB().getHSB()[2];
+ }
+
+ public ColorHSL(float hue, float saturation, float luminance) {
+ this(new Color(PlatformUI.getWorkbench().getDisplay(), new RGB(hue, saturation, luminance)));
+ }
+
+ // TODO: Add test coverage
+ public ColorHSL modifyProperty(HSL_PROPERTY propertyToModify, BOUND_BEHAVIOR boundBehavior, float amount) {
+ // Hue must be within the range [0, 360]
+ // Saturation must be within the range [0, 1]
+ // Luminance must be within the range [0, 1]
+ float newValue = -1;
+ float max = 1;
+ float min = 0;
+
+ switch (propertyToModify) {
+ case HUE:
+ max = 360;
+ newValue = hue;
+ break;
+ case SATURATION:
+ newValue = saturation;
+ break;
+ case LUMINANCE:
+ newValue = luminance;
+ break;
+ }
+
+ newValue = newValue + amount;
+
+ switch (boundBehavior) {
+ case CYCLE:
+ if (newValue < min) {
+ newValue = max - Math.abs(newValue);
+ } else if (newValue > max) {
+ newValue = min + (newValue - max);
+ }
+ break;
+ case LIMIT:
+ newValue = setFloatBounds(newValue, min, max);
+ break;
+ case REVERSE:
+ if (newValue < min) {
+ newValue = min + Math.abs(newValue);
+ } else if (newValue > max) {
+ newValue = max - (newValue - max);
+ }
+
+ }
+
+ switch (propertyToModify) {
+ case HUE:
+ return new ColorHSL(newValue, this.getSaturation(), this.getLuminance());
+ case SATURATION:
+ return new ColorHSL(this.getHue(), newValue, this.getLuminance());
+ case LUMINANCE:
+ return new ColorHSL(this.getHue(), this.getSaturation(), newValue);
+ }
+
+ return null;
+ }
+
+ public void dispose() {
+ color.dispose();
+ }
+
+ public Color getColor() {
+ return color;
+ }
+
+ public float getHue() {
+ return hue;
+ }
+
+ public float getSaturation() {
+ return saturation;
+ }
+
+ public float getLuminance() {
+ return luminance;
+ }
+
+ public float getPerceivedLuminance() {
+ return (299f * color.getRed() + 587f * color.getGreen() + 114f * color.getBlue()) / 1000;
+ }
+
+ public ColorHSL setHue(float hue) {
+ hue = setFloatBounds(hue, 0, 360);
+ return new ColorHSL(hue, this.getSaturation(), this.getLuminance());
+ }
+
+ public ColorHSL setSaturation(float saturation) {
+ saturation = setFloatBounds(saturation, 0, 1);
+ return new ColorHSL(this.getHue(), saturation, this.getLuminance());
+ }
+
+ public ColorHSL setLuminance(float luminance) {
+ luminance = setFloatBounds(luminance, 0, 1);
+ return new ColorHSL(this.getHue(), this.getSaturation(), luminance);
+ }
+
+ private static float setFloatBounds(float value, float min, float max) {
+ value = Math.min(value, max);
+ value = Math.max(value, min);
+ return value;
+ }
+
+ /*
+ * How the modification amount to a property should behave when hitting an upper
+ * or lower bound.
+ */
+ enum BOUND_BEHAVIOR {
+ /*
+ * Jump from one bound to another. Example: For a color with a luminance of
+ * 0.6f, increasing the luminance by 0.5f while using the CYCLE BOUND_BEHAVIOR
+ * will result in the color having a luminance of 0.1f.
+ */
+ CYCLE,
+
+ /*
+ * Negate any excess amount from the bound. Example: For a color with a
+ * luminance of 0.6f, increasing the luminance by 0.5f while using the REVERSE
+ * BOUND_BEHAVIOR will result in the color having a luminance of 0.9f.
+ */
+ REVERSE,
+
+ /*
+ * Set the amount to the nearest bound. Example: Fora color with a luminance of
+ * 0.6f, increasing the luminance by 0.5f while using the LIMIT BOUND_BEHAVIOR
+ * will result in the color having a luminance of 1f.
+ */
+ LIMIT;
+ }
+
+ enum HSL_PROPERTY {
+ HUE, SATURATION, LUMINANCE;
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorManager.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorManager.java
new file mode 100644
index 0000000..3d129a7
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorManager.java
@@ -0,0 +1,207 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.themes.WorkbenchThemeManager;
+import org.osgi.service.prefs.BackingStoreException;
+
+import com.aobuchow.themes.spectrum.preferences.ColorHSL.BOUND_BEHAVIOR;
+import com.aobuchow.themes.spectrum.preferences.ColorHSL.HSL_PROPERTY;
+
+public class ColorManager {
+ private static final String BACKGROUND_COLOR_ID = "com.aobuchow.themes.spectrum.BACKGROUND_COLOR";
+ private static final String BASE_COLOR_ID = "com.aobuchow.themes.spectrum.BASE_COLOR";
+ private static final String ACCENT_COLOR_ID = "com.aobuchow.themes.spectrum.ACCENT_COLOR";
+ private ColorRegistry colorRegistry;
+ private Color accentColor;
+ private Color baseColor;
+ private Color backgroundColor;
+ private IThemeEngine engine;
+ private final String THEME_ID = "spectrum.dark.theme.id";
+ private Display display;
+ private IEventBroker eventBroker;
+
+ public ColorManager() {
+ MApplication application = PlatformUI.getWorkbench().getService(MApplication.class);
+ IEclipseContext context = application.getContext();
+ engine = context.get(IThemeEngine.class);
+ display = PlatformUI.getWorkbench().getDisplay();
+ eventBroker = PlatformUI.getWorkbench().getService(IEventBroker.class);
+ updateColors();
+ }
+
+ // Should only be called from PluginStartup theme registry listener, clients
+ // should use saveColors() instead
+ public void updateColors() {
+ this.colorRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
+ accentColor = colorRegistry.get(ACCENT_COLOR_ID);
+ baseColor = colorRegistry.get(BASE_COLOR_ID);
+ backgroundColor = colorRegistry.get(BACKGROUND_COLOR_ID);
+ if (engine.getActiveTheme().getId().equals(THEME_ID)) {
+ updateGitColors();
+ updateThemeFontColors();
+ savePreferences();
+ }
+ }
+
+ public void saveColors() {
+ setColorPreference(BACKGROUND_COLOR_ID, backgroundColor);
+ colorRegistry.put(BACKGROUND_COLOR_ID, backgroundColor.getRGB());
+ setColorPreference(BASE_COLOR_ID, baseColor);
+ colorRegistry.put(BASE_COLOR_ID, baseColor.getRGB());
+ setColorPreference(ACCENT_COLOR_ID, accentColor);
+ colorRegistry.put(ACCENT_COLOR_ID, accentColor.getRGB());
+ savePreferences();
+ updateColors();
+ eventBroker.send(WorkbenchThemeManager.Events.THEME_REGISTRY_MODIFIED, null);
+ }
+
+ private void savePreferences() {
+ try {
+ InstanceScope.INSTANCE.getNode(PlatformUI.PLUGIN_ID).flush();
+ } catch (BackingStoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getCurrentColorSchemeCSS() {
+ String accentColorHex = ColorUtils.colorToHex(accentColor);
+ String baseColorHex = ColorUtils.colorToHex(baseColor);
+ String backgroundColorHex = ColorUtils.colorToHex(backgroundColor);
+ String currentColorScheme = "ColorScheme {\n" + " --background-color: " + backgroundColorHex + ";\n"
+ + " --base-color: " + baseColorHex + ";\n" + " --accent-color: " + accentColorHex + ";\n" + "}";
+ return currentColorScheme;
+ }
+
+ public void setStyledTextColoring(StyledText colorScheme) {
+ display.asyncExec(() -> {
+ Color white = display.getSystemColor(SWT.COLOR_WHITE);
+ Color black = display.getSystemColor(SWT.COLOR_BLACK);
+ String text = colorScheme.getText();
+
+ StyleRange bgStyle = new StyleRange();
+ bgStyle.start = text.indexOf("--background-color:") + "--background-color:".length() + 1;
+ bgStyle.length = 7;
+ bgStyle.fontStyle = SWT.BOLD;
+ bgStyle.background = backgroundColor;
+ bgStyle.foreground = ColorUtils.useReadableForegroundColor(backgroundColor, white, black);
+ colorScheme.setStyleRange(bgStyle);
+
+ StyleRange baseStyle = new StyleRange();
+ baseStyle.start = text.indexOf("--base-color:") + "--base-color:".length() + 1;
+ baseStyle.length = 7;
+ baseStyle.fontStyle = SWT.BOLD;
+ baseStyle.background = baseColor;
+ baseStyle.foreground = ColorUtils.useReadableForegroundColor(baseColor, white, black);
+ colorScheme.setStyleRange(baseStyle);
+
+ StyleRange accentStyle = new StyleRange();
+ accentStyle.start = text.indexOf("--accent-color:") + "--accent-color:".length() + 1;
+ accentStyle.length = 7;
+ accentStyle.fontStyle = SWT.BOLD;
+ accentStyle.foreground = ColorUtils.useReadableForegroundColor(accentColor, white, black);
+ accentStyle.background = accentColor;
+ colorScheme.setStyleRange(accentStyle);
+ });
+ }
+
+ public void dispose() {
+ accentColor.dispose();
+ baseColor.dispose();
+ backgroundColor.dispose();
+ }
+
+ private void updateGitColors() {
+ display.asyncExec(() -> {
+ ColorHSL uncommittedChangeBackground = new ColorHSL(backgroundColor).modifyProperty(HSL_PROPERTY.LUMINANCE,
+ BOUND_BEHAVIOR.REVERSE, 0.1f);
+ uncommittedChangeBackground = uncommittedChangeBackground.modifyProperty(HSL_PROPERTY.SATURATION,
+ BOUND_BEHAVIOR.LIMIT, 0.1f);
+ uncommittedChangeBackground = uncommittedChangeBackground.modifyProperty(HSL_PROPERTY.HUE,
+ BOUND_BEHAVIOR.CYCLE, 5f);
+ Color uncommittedChangeForeground = ColorUtils.useReadableForegroundColor(
+ uncommittedChangeBackground.getColor(), display.getSystemColor(SWT.COLOR_WHITE),
+ display.getSystemColor(SWT.COLOR_BLACK));
+ setColorPreference("org.eclipse.egit.ui.UncommittedChangeForegroundColor", uncommittedChangeForeground);
+ setColorPreference("org.eclipse.egit.ui.UncommittedChangeBackgroundColor",
+ uncommittedChangeBackground.getColor());
+ });
+ }
+
+ private void updateThemeFontColors() {
+ display.asyncExec(() -> {
+ Color primaryFontColor = ColorUtils.useReadableForegroundColor(
+ backgroundColor, display.getSystemColor(SWT.COLOR_WHITE),
+ display.getSystemColor(SWT.COLOR_BLACK));
+ Color activeFontColor = ColorUtils.useReadableForegroundColor(
+ accentColor, display.getSystemColor(SWT.COLOR_WHITE),
+ display.getSystemColor(SWT.COLOR_BLACK));
+ Color inactiveFontColor = ColorUtils.useReadableForegroundColor(
+ baseColor, display.getSystemColor(SWT.COLOR_WHITE),
+ display.getSystemColor(SWT.COLOR_BLACK));
+ setColorPreference("com.aobuchow.themes.spectrum.PRIMARY_FONT_COLOR", primaryFontColor);
+ setColorPreference("com.aobuchow.themes.spectrum.ACTIVE_FONT_COLOR", activeFontColor);
+ setColorPreference("com.aobuchow.themes.spectrum.INACTIVE_FONT_COLOR", inactiveFontColor);
+ });
+ }
+
+ private void setColorPreference(String preferenceKey, Color color) {
+ // We can't use PlatformUI.getPreferenceStore() as it won't affect preferences
+ // for plugins such as EGit
+ PlatformUI.getWorkbench().getPreferenceStore().setValue(preferenceKey,
+ String.format("%d,%d,%d", color.getRed(), color.getGreen(), color.getBlue()));
+ }
+
+ public Color getAccentColor() {
+ return accentColor;
+ }
+
+ public void setAccentColor(Color accentColor) {
+ this.accentColor = accentColor;
+ }
+
+ public Color getBaseColor() {
+ return baseColor;
+ }
+
+ public void setBaseColor(Color baseColor) {
+ this.baseColor = baseColor;
+ }
+
+ public Color getBackgroundColor() {
+ return backgroundColor;
+ }
+
+ public void setBackgroundColor(Color backgroundColor) {
+ this.backgroundColor = backgroundColor;
+ }
+
+ public List getThemeColors() {
+ List colors = new ArrayList<>();
+ colors.add(accentColor);
+ colors.add(baseColor);
+ colors.add(backgroundColor);
+ return colors;
+ }
+
+ public void resetColors() {
+ this.setBackgroundColor(new Color(display, 23, 23, 27));
+ this.setBaseColor(new Color(display, 47, 47, 47));
+ this.setAccentColor(new Color(display, 215, 0, 0));
+ this.saveColors();
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorUtils.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorUtils.java
new file mode 100644
index 0000000..ca4feb2
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/ColorUtils.java
@@ -0,0 +1,25 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.swt.graphics.Color;
+
+public interface ColorUtils {
+
+ static final String RGB_TO_HEX = "#%02X%02X%02X";
+
+ public static String colorToHex(Color color) {
+ return String.format(RGB_TO_HEX, color.getRed(), color.getGreen(), color.getBlue());
+ }
+
+ public static int maxRGB(Color color) {
+ return Math.max(color.getRed(), Math.max(color.getGreen(), color.getBlue()));
+ }
+
+ public static int minRGB(Color color) {
+ return Math.min(color.getRed(), Math.min(color.getGreen(), color.getBlue()));
+ }
+
+ public static Color useReadableForegroundColor(Color backgroundColor, Color white, Color black) {
+ return new ColorHSL(backgroundColor).getPerceivedLuminance() >= 127.5f ? black : white;
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Messages.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Messages.java
new file mode 100644
index 0000000..502d545
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/Messages.java
@@ -0,0 +1,24 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "com.aobuchow.themes.spectrum.preferences.messages"; //$NON-NLS-1$
+ public static String PreferencesPage_LabelHue;
+ public static String PreferencesPage_LabelLuminance;
+ public static String PreferencesPage_LabelSaturation;
+ public static String SpectrumPreferencePage_BugReportLink;
+ public static String SpectrumPreferencePage_CommunityGroup;
+ public static String SpectrumPreferencePage_CustomizationGroup;
+ public static String SpectrumPreferencePage_RepositoryLink;
+ public static String SpectrumPreferencePage_GithubURL_Issues;
+ public static String SpectrumPreferencePage_GithubURL;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PluginStartup.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PluginStartup.java
new file mode 100644
index 0000000..1d63983
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PluginStartup.java
@@ -0,0 +1,28 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.themes.WorkbenchThemeManager;
+import org.osgi.service.event.EventHandler;
+
+public class PluginStartup implements IStartup {
+
+ @Override
+ public void earlyStartup() {
+ IEventBroker eventBroker = PlatformUI.getWorkbench().getService(IEventBroker.class);
+ eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_RESTYLED, themeRegistryRestyledHandler);
+ eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_MODIFIED, themeRegistryRestyledHandler);
+ Activator.getDefault().getColorManager().updateColors();
+
+ }
+
+ // TODO: investigate why this listener is required here. Setting it in the
+ // ColorManager doesn't seem to
+ // respond to theme registry events.
+ private EventHandler themeRegistryRestyledHandler = event -> {
+ // TODO: Update git uncommitted changes font to use project explorer font?
+ Activator.getDefault().getColorManager().updateColors();
+ };
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PreferencesPage.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PreferencesPage.java
new file mode 100644
index 0000000..601ab09
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/PreferencesPage.java
@@ -0,0 +1,162 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.themes.WorkbenchThemeManager;
+import org.osgi.service.event.EventHandler;
+
+import com.aobuchow.themes.spectrum.preferences.ColorHSL.BOUND_BEHAVIOR;
+import com.aobuchow.themes.spectrum.preferences.ColorHSL.HSL_PROPERTY;
+
+public class PreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private Color prevAccentColor;
+ private Color prevBaseColor;
+ private IEventBroker eventBroker;
+ private ColorManager colorManager;
+ private Color prevBackgroundColor;
+
+ private SpectrumPreferencesControl preferenceControl;
+
+ @Override
+ public void init(IWorkbench workbench) {
+ colorManager = Activator.getDefault().getColorManager();
+ eventBroker = workbench.getService(IEventBroker.class);
+ eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_RESTYLED, themeRegistryRestyledHandler);
+ eventBroker.subscribe(WorkbenchThemeManager.Events.THEME_REGISTRY_MODIFIED, themeRegistryRestyledHandler);
+ setPreferenceStore(PlatformUI.getPreferenceStore());
+
+ prevBackgroundColor = colorManager.getBackgroundColor();
+ prevBaseColor = colorManager.getBaseColor();
+ prevAccentColor = colorManager.getAccentColor();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ preferenceControl = new SpectrumPreferencesControl(parent, SWT.NONE);
+
+ addHSLCustomization(preferenceControl);
+
+ preferenceControl.getRepoLink().addSelectionListener(
+ SelectionListener.widgetSelectedAdapter(e -> openURL("repo", Messages.SpectrumPreferencePage_GithubURL)));
+
+ preferenceControl.getIssuesLink().addSelectionListener(SelectionListener
+ .widgetSelectedAdapter(e -> openURL("issues", Messages.SpectrumPreferencePage_GithubURL_Issues)));
+
+ String currentColorScheme = Activator.getDefault().getColorManager().getCurrentColorSchemeCSS();
+ final StyledText cssText = preferenceControl.getCssText();
+ cssText.setText(currentColorScheme);
+ Activator.getDefault().getColorManager().setStyledTextColoring(cssText);
+
+ refresh();
+
+ return preferenceControl;
+ }
+
+ private void addHSLCustomization(SpectrumPreferencesControl control) {
+ final Scale hueScale = control.getHueScale();
+ hueScale.addListener(SWT.Selection, event -> {
+ int selectionValue = hueScale.getSelection();
+ ColorHSL newBackgroundColor = new ColorHSL(colorManager.getBackgroundColor()).setHue(selectionValue);
+ ColorHSL newBaseColor = new ColorHSL(prevBaseColor).setHue(selectionValue)
+ .modifyProperty(HSL_PROPERTY.SATURATION, BOUND_BEHAVIOR.LIMIT, -0.1f);
+ ColorHSL newAccentColor = new ColorHSL(colorManager.getAccentColor()).setHue(selectionValue);
+ colorManager.setBackgroundColor(newBackgroundColor.getColor());
+ colorManager.setBaseColor(newBaseColor.getColor());
+ colorManager.setAccentColor(newAccentColor.getColor());
+ colorManager.saveColors();
+ });
+
+ final Scale saturationScale = control.getSaturationScale();
+ saturationScale.addListener(SWT.Selection, event -> {
+ float selectionValue = ((float) saturationScale.getSelection()) / 100;
+ ColorHSL newBackgroundColor = new ColorHSL(colorManager.getBackgroundColor()).setSaturation(selectionValue);
+ colorManager.setBackgroundColor(newBackgroundColor.getColor());
+ colorManager.saveColors();
+ });
+
+ final Scale brightnessScale = control.getBrightnessScale();
+ brightnessScale.addListener(SWT.Selection, event -> {
+ float selectionValue = ((float) brightnessScale.getSelection()) / 100;
+ ColorHSL newBackgroundColor = new ColorHSL(colorManager.getBackgroundColor()).setLuminance(selectionValue);
+ colorManager.setBackgroundColor(newBackgroundColor.getColor());
+ colorManager.saveColors();
+ });
+ }
+
+ @Override
+ public boolean performOk() {
+ prevBackgroundColor = colorManager.getBackgroundColor();
+ prevBaseColor = colorManager.getBaseColor();
+ prevAccentColor = colorManager.getAccentColor();
+ refresh();
+ return super.performOk();
+ }
+
+ @Override
+ protected void performDefaults() {
+ colorManager.resetColors();
+ refresh();
+ super.performDefaults();
+ }
+
+ @Override
+ public boolean performCancel() {
+ colorManager.setBackgroundColor(prevBackgroundColor);
+ colorManager.setBaseColor(prevBaseColor);
+ colorManager.setAccentColor(prevAccentColor);
+ colorManager.saveColors();
+ prevBackgroundColor = colorManager.getBackgroundColor();
+ prevBaseColor = colorManager.getBaseColor();
+ prevAccentColor = colorManager.getAccentColor();
+ refresh();
+ return super.performCancel();
+ }
+
+ private EventHandler themeRegistryRestyledHandler = event -> {
+ // Update the relevant UI when the theme's colors are modified
+ if (!getControl().isDisposed()) {
+ String currentColorScheme = Activator.getDefault().getColorManager().getCurrentColorSchemeCSS();
+ final StyledText cssText = preferenceControl.getCssText();
+ cssText.setText(currentColorScheme);
+ Activator.getDefault().getColorManager().setStyledTextColoring(cssText);
+ }
+ };
+
+ private void refresh() {
+ refreshScales();
+ refreshCssText();
+ }
+
+ private void refreshScales() {
+ preferenceControl.getHueScale().setSelection((int) new ColorHSL(colorManager.getBackgroundColor()).getHue());
+ preferenceControl.getSaturationScale()
+ .setSelection((int) (new ColorHSL(colorManager.getBackgroundColor()).getSaturation() * 100));
+ preferenceControl.getBrightnessScale()
+ .setSelection((int) (new ColorHSL(colorManager.getBackgroundColor()).getLuminance() * 100));
+ }
+
+ private void refreshCssText() {
+ String currentColorScheme = Activator.getDefault().getColorManager().getCurrentColorSchemeCSS();
+ final StyledText cssText = preferenceControl.getCssText();
+ if (!cssText.getText().equals(currentColorScheme)) {
+ cssText.setText(currentColorScheme);
+ }
+ }
+
+ private void openURL(String category, String url) {
+ BrowserUtils.openUrl(category, url);
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/SpectrumPreferencesControl.java b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/SpectrumPreferencesControl.java
new file mode 100644
index 0000000..92b47ad
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/SpectrumPreferencesControl.java
@@ -0,0 +1,141 @@
+package com.aobuchow.themes.spectrum.preferences;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * Control to be displayed on the preference page.
+ *
+ *
+ * - Has scales for the three settings; hue, saturation and brightness
+ * - Has a CSS scheme text widget
+ * - Has links to open the Gitub repo page and the Github issues page
+ *
+ */
+public class SpectrumPreferencesControl extends Composite {
+
+ private Scale hueScale;
+
+ private Scale saturationScale;
+
+ private Scale brightnessScale;
+
+ private StyledText cssText;
+
+ private Link repoLink;
+
+ private Link issuesLink;
+
+ private FormToolkit kit;
+
+ public SpectrumPreferencesControl(Composite parent, int style) {
+ super(parent, style);
+
+ kit = new FormToolkit(parent.getDisplay());
+
+ create();
+
+ addDisposeListener(e -> {
+ if (kit != null) {
+ kit.dispose();
+ }
+ });
+ }
+
+ private void create() {
+ setLayout(GridLayoutFactory.fillDefaults().create());
+ createSettingsGroup();
+ createComunityGroup();
+ }
+
+ private void createSettingsGroup() {
+ Group group = new Group(this, SWT.SHADOW_ETCHED_IN);
+ group.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
+ group.setText(Messages.SpectrumPreferencePage_CustomizationGroup);
+ group.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create());
+
+ hueScale = createScaleLine(group, Messages.PreferencesPage_LabelHue, 0, 360);
+ saturationScale = createScaleLine(group, Messages.PreferencesPage_LabelSaturation, 0, 100);
+ brightnessScale = createScaleLine(group, Messages.PreferencesPage_LabelLuminance, 0, 100);
+
+ createCssExandable(group);
+ }
+
+ private Scale createScaleLine(Composite parent, String labelText, int min, int max) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(labelText);
+ label.setLayoutData(GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
+
+ Scale scale = new Scale(parent, SWT.HORIZONTAL);
+ scale.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
+ scale.setMinimum(min);
+ scale.setMaximum(max);
+ scale.setIncrement(5);
+ scale.setPageIncrement(5);
+
+ return scale;
+ }
+
+ private void createCssExandable(Composite parent) {
+ ExpandableComposite expandableComposite = kit.createExpandableComposite(parent, ExpandableComposite.TWISTIE);
+ expandableComposite.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).create());
+ expandableComposite.setText("CSS");
+
+ cssText = new StyledText(expandableComposite, SWT.BORDER);
+ expandableComposite.setClient(cssText);
+ }
+
+ private void createComunityGroup() {
+ Group group = new Group(this, SWT.SHADOW_ETCHED_IN);
+ group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
+ group.setText(Messages.SpectrumPreferencePage_CommunityGroup);
+ group.setLayout(GridLayoutFactory.swtDefaults().create());
+
+ repoLink = createLink(group, Messages.SpectrumPreferencePage_RepositoryLink,
+ Messages.SpectrumPreferencePage_GithubURL);
+
+ issuesLink = createLink(group, Messages.SpectrumPreferencePage_BugReportLink,
+ Messages.SpectrumPreferencePage_GithubURL_Issues);
+ }
+
+ private Link createLink(Composite parent, String text, String targetUrl) {
+ Link link = new Link(parent, SWT.NONE);
+ link.setText(text);
+ return link;
+ }
+
+ public Scale getHueScale() {
+ return hueScale;
+ }
+
+ public Scale getSaturationScale() {
+ return saturationScale;
+ }
+
+ public Scale getBrightnessScale() {
+ return brightnessScale;
+ }
+
+ public StyledText getCssText() {
+ return cssText;
+ }
+
+ public Link getRepoLink() {
+ return repoLink;
+ }
+
+ public Link getIssuesLink() {
+ return issuesLink;
+ }
+
+}
diff --git a/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/messages.properties b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/messages.properties
new file mode 100644
index 0000000..95f7895
--- /dev/null
+++ b/com.aobuchow.themes.spectrum.preferences/src/com/aobuchow/themes/spectrum/preferences/messages.properties
@@ -0,0 +1,10 @@
+PreferencesPage_LabelHue=Hue:
+PreferencesPage_LabelLuminance=Brightness:
+PreferencesPage_LabelSaturation=Saturation:
+SpectrumPreferencePage_BugReportLink=Report a bug or feature request: Open GitHub Issues
+SpectrumPreferencePage_CommunityGroup=Get involved:
+SpectrumPreferencePage_CustomizationGroup=Customization:
+SpectrumPreferencePage_RepositoryLink=Spectrum Theme is open-source: Open GitHub repository
+SpectrumPreferencePage_GithubURL_Issues=https://github.com/AObuchow/Eclipse-Spectrum-Theme/issues
+SpectrumPreferencePage_GithubURL=https://github.com/AObuchow/Eclipse-Spectrum-Theme
+
diff --git a/com.aobuchow.themes.spectrum/META-INF/MANIFEST.MF b/com.aobuchow.themes.spectrum/META-INF/MANIFEST.MF
index 9c64736..21e4560 100644
--- a/com.aobuchow.themes.spectrum/META-INF/MANIFEST.MF
+++ b/com.aobuchow.themes.spectrum/META-INF/MANIFEST.MF
@@ -6,5 +6,5 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: aobuchow
Automatic-Module-Name: Spectrum_Theme
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.e4.ui.css.swt.theme;bundle-version="0.12.700",
+Require-Bundle: org.eclipse.e4.ui.css.swt.theme;bundle-version="[0.12.700,0.14.000)",
org.eclipse.ui
diff --git a/com.aobuchow.themes.spectrum/css/color_definitions.css b/com.aobuchow.themes.spectrum/css/color_definitions.css
index e37e6b9..7f93742 100644
--- a/com.aobuchow.themes.spectrum/css/color_definitions.css
+++ b/com.aobuchow.themes.spectrum/css/color_definitions.css
@@ -11,74 +11,8 @@
*******************************************************************************/
ThemesExtension {
- color-definition: '#org-eclipse-ui-workbench-INACTIVE_TAB_UNSELECTED_TEXT_COLOR',
- '#org-eclipse-ui-workbench-INACTIVE_TAB_SELECTED_TEXT_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_TAB_UNSELECTED_TEXT_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_SELECTED_TEXT_COLOR',
- '#org-eclipse-ui-workbench-LINK_COLOR',
- '#com-aobuchow-themes-spectrum-ACCENT_COLOR',
- '#com-aobuchow-themes-spectrum-BASE_COLOR',
- '#com-aobuchow-themes-spectrum-TAB_HOVER_COLOR',
- '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
-}
-
-ColorDefinition#com-aobuchow-themes-spectrum-ACCENT_COLOR {
- color: #d70000;
- category: '#com-aobuchow-themes-spectrum-themeCategory';
- label: 'Accent Color';
- description: 'The accent color used in Spectrum theme.';
-}
-
-ColorDefinition#com-aobuchow-themes-spectrum-BASE_COLOR {
- color: #2f2f2f;
- category: '#com-aobuchow-themes-spectrum-themeCategory';
- label: 'Base Color';
- description: 'The base color used in Spectrum theme.';
-}
-
-ColorDefinition#com-aobuchow-themes-spectrum-TAB_HOVER_COLOR {
- color: #161616;
- category: '#com-aobuchow-themes-spectrum-themeCategory';
- label: 'Tab Hover Color';
- description: 'The color used when an hovering on a tab in Spectrum theme.';
-}
-
-ColorDefinition#com-aobuchow-themes-spectrum-BACKGROUND_COLOR {
- color: #17171b;
- category: '#com-aobuchow-themes-spectrum-themeCategory';
- label: 'Background Color';
- description: 'The background color used in Spectrum theme.';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_UNSELECTED_TEXT_COLOR {
- color: #bbbbbb;
- category: '#org-eclipse-ui-presentation-default';
- label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_TAB_UNSELECTED_TEXT_COLOR');
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_SELECTED_TEXT_COLOR {
- color: #ffffff;
- category: '#org-eclipse-ui-presentation-default';
- label: url('platform:/plugin/org.eclipse.ui.themes?message=INACTIVE_TAB_SELECTED_TEXT_COLOR');
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_UNSELECTED_TEXT_COLOR {
- color: white;
- category: '#org-eclipse-ui-presentation-default';
- label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_TAB_UNSELECTED_TEXT_COLOR');
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR {
- color: white;
- category: '#org-eclipse-ui-presentation-default';
- label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_TAB_SELECTED_TEXT_COLOR');
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_SELECTED_TEXT_COLOR {
- color: #cccccc;
- category: '#org-eclipse-ui-presentation-default';
- label: url('platform:/plugin/org.eclipse.ui.themes?message=ACTIVE_NOFOCUS_TAB_SELECTED_TEXT_COLOR');
+ color-definition:
+ '#org-eclipse-ui-workbench-LINK_COLOR';
}
ColorDefinition#org-eclipse-ui-workbench-LINK_COLOR {
diff --git a/com.aobuchow.themes.spectrum/css/default_overrides.css b/com.aobuchow.themes.spectrum/css/default_overrides.css
index cb06d5e..926f352 100644
--- a/com.aobuchow.themes.spectrum/css/default_overrides.css
+++ b/com.aobuchow.themes.spectrum/css/default_overrides.css
@@ -15,38 +15,12 @@
font-weight: bold;
}
-/* ###################### CTabFolder ########################## */
-
-CTabItem,
-CTabItem CLabel {
- /* background-color: '#com-aobuchow-themes-spectrum-ACCENT_COLOR'; HACK for background of CTabFolder inner Toolbars */
- color: '#org-eclipse-ui-workbench-INACTIVE_TAB_UNSELECTED_TEXT_COLOR';
-}
-CTabItem:selected,
-CTabItem:selected CLabel {
- color: '#org-eclipse-ui-workbench-INACTIVE_TAB_SELECTED_TEXT_COLOR';
-}
-
-.MPartStack.active > CTabItem,
-.MPartStack.active > CTabItem CLabel {
- /* background-color: '#com-aobuchow-themes-spectrum-ACCENT_COLOR'; HACK for background of CTabFolder inner Toolbars */
- color: '#org-eclipse-ui-workbench-ACTIVE_TAB_UNSELECTED_TEXT_COLOR';
-}
-.MPartStack.active > CTabItem:selected,
-.MPartStack.active > CTabItem:selected CLabel {
- color: '#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR';
-}
-
-.MPartStack.active.noFocus > CTabItem:selected {
- color: '#org-eclipse-ui-workbench-ACTIVE_NOFOCUS_TAB_SELECTED_TEXT_COLOR';
-}
-
/* ###################### Tree, Table ########################## */
Tree,
Table {
- color: white;
- swt-header-color: white;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
+ swt-header-color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
swt-header-background-color: '#com-aobuchow-themes-spectrum-BASE_COLOR';
swt-selection-background-color: '#com-aobuchow-themes-spectrum-ACCENT_COLOR';
swt-selection-foreground-color: black;
@@ -67,11 +41,11 @@ Composite#org-eclipse-ui-navigator-ProjectExplorer * {
.MPartStack.active Table {
background-color: '#com-aobuchow-themes-spectrum-BASE_COLOR';
- color: #ccc;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
.View {
background-color: '#com-aobuchow-themes-spectrum-BASE_COLOR';
- color: #f5f5f5;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
/* ###################### Hyperlink ########################## */
@@ -103,7 +77,7 @@ Composite#org-eclipse-ui-navigator-ProjectExplorer * {
/* Color in between text editors */
.MPartSashContainer {
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
- color: #eeeeee;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
/* ###################### Form Editors ########################## */
@@ -202,7 +176,7 @@ Section {
.MPart Section > Label {
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
- color: white;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
ExpandableComposite {
@@ -230,7 +204,7 @@ Shell > Composite > Composite > Composite > Composite > Composite > List,
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 > List,
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 > * > List {
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR'; /* TODO: This should be SECONDARY_COLOR_DULL */
- color: white;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
#org-eclipse-ui-main-toolbar,
@@ -239,7 +213,7 @@ Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][s
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR'
'#com-aobuchow-themes-spectrum-BACKGROUND_COLOR' 100%;
handle-image: none;
- color: #ebe8e4;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
/* ############################## Console View ############################## */
@@ -248,7 +222,7 @@ Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][s
#org-eclipse-ui-console-ConsoleView .MPart StyledText,
#org-eclipse-ui-console-ConsoleView .MPart PageBook Label {
background-color: black;
- color: white;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
/* ############################## Global Styles ############################## */
@@ -280,7 +254,7 @@ Shell[style~='SWT.RADIO'][style~='SWT.CASCADE'][style~='SWT.SHADOW_ETCHED_IN'][s
.MPart DependenciesComposite > SashForm > Section > * {
/* Section > DependenciesComposite$... */
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
- color: #eeeeee;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
Shell,
@@ -328,7 +302,7 @@ Composite > *,
Composite > * > *,
Group > StyledText {
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
- color: #eeeeee;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
Composite > StyledText,
@@ -336,7 +310,7 @@ Shell [style~='SWT.DROP_DOWN'] > StyledText, /* for eg. folded code popup (but i
SashForm > StyledText {
/* Fix StyledText inside a SashForm */
background-color: '#com-aobuchow-themes-spectrum-BACKGROUND_COLOR';
- color: #eeeeee;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
.MPart Table,
@@ -347,7 +321,7 @@ SashForm > StyledText {
.MPart PageBook > Label,
.MPart PageBook > SashForm {
background-color: #161616; /* hard coded since color definitions dont seem to work here? */
- color: #ccc;
+ color: '#com-aobuchow-themes-spectrum-PRIMARY_FONT_COLOR';
}
/* Toolbar should inherit the colors of its container to avoid drawing artifacts*/
diff --git a/com.aobuchow.themes.spectrum/css/preference_styles.css b/com.aobuchow.themes.spectrum/css/preference_styles.css
index 63d1df9..a074c51 100644
--- a/com.aobuchow.themes.spectrum/css/preference_styles.css
+++ b/com.aobuchow.themes.spectrum/css/preference_styles.css
@@ -20,7 +20,7 @@ IEclipsePreferences#org-eclipse-ui-editors:com-aobuchow-themes-spectrum-editors
'AbstractTextEditor.Color.Foreground.SystemDefault=false'
'hyperlinkColor.SystemDefault=false'
'hyperlinkColor=40,235,195'
- 'asOccurencesIndicationColor=72,72,72'
+ 'asOccurencesIndicationColor=255,72,72'
'breakpointIndicationColor=51,119,193'
'currentIPColor=90,90,90'
'infoIndicationColor=86,194,170'
diff --git a/com.aobuchow.themes.spectrum/css/tabstyle.css b/com.aobuchow.themes.spectrum/css/tabstyle.css
index 0cc584c..0364cbb 100644
--- a/com.aobuchow.themes.spectrum/css/tabstyle.css
+++ b/com.aobuchow.themes.spectrum/css/tabstyle.css
@@ -60,12 +60,12 @@ CTabFolder[style~='SWT.DOWN'][style~='SWT.BOTTOM'] {
.MPartStack.active > CTabItem,
.MPartStack.active > CTabItem CLabel {
background-color: '#com-aobuchow-themes-spectrum-ACCENT_COLOR'; /* HACK for background of CTabFolder inner Toolbars */
- color: '#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR';
+ color: '#com-aobuchow-themes-spectrum-INACTIVE_FONT_COLOR';
}
.MPartStack.active > CTabItem:selected,
.MPartStack.active > CTabItem:selected CLabel {
- color: '#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR';
+ color: '#com-aobuchow-themes-spectrum-ACTIVE_FONT_COLOR';
}
CTabFolder > Composite#ToolbarComposite {
@@ -88,5 +88,23 @@ CTabFolder Scale {
CTabItem,
CTabItem CLabel {
background-color: '#com-aobuchow-themes-spectrum-BASE_COLOR'; /* HACK for background of CTabFolder inner Toolbars */
- color: '#org-eclipse-ui-workbench-ACTIVE_TAB_SELECTED_TEXT_COLOR';
+ color: '#com-aobuchow-themes-spectrum-INACTIVE_FONT_COLOR';
+}
+
+/* ###################### Below used to be in default overrides ########################## */
+
+/* TODO: Maybe inactive tabs should have a darker color? */
+CTabItem:selected,
+CTabItem:selected CLabel {
+ color: '#com-aobuchow-themes-spectrum-INACTIVE_FONT_COLOR';
+}
+
+.MPartStack.active > CTabItem,
+.MPartStack.active > CTabItem CLabel {
+ /* background-color: '#com-aobuchow-themes-spectrum-ACCENT_COLOR'; HACK for background of CTabFolder inner Toolbars */
+ color: '#com-aobuchow-themes-spectrum-INACTIVE_FONT_COLOR';
+}
+
+.MPartStack.active.noFocus > CTabItem:selected {
+ color: '#com-aobuchow-themes-spectrum-INACTIVE_FONT_COLOR';
}
diff --git a/com.aobuchow.themes.spectrum/plugin.xml b/com.aobuchow.themes.spectrum/plugin.xml
index 138d6c4..d515fb0 100644
--- a/com.aobuchow.themes.spectrum/plugin.xml
+++ b/com.aobuchow.themes.spectrum/plugin.xml
@@ -23,6 +23,68 @@
id="com.aobuchow.themes.spectrum.themeCategory"
label="Spectrum">
+
+
+
+
+ The accent color used in Spectrum theme.
+
+
+
+
+ The base color used in Spectrum theme.
+
+
+
+
+ The background color used in Spectrum theme.
+
+
+
+
+ The color used when an hovering on a tab in Spectrum theme.
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index f4b77f5..86d1ff5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,7 @@
com.aobuchow.themes.spectrum
+ com.aobuchow.themes.spectrum.preferences
com.aobuchow.themes.spectrum.feature
releng-updatesite