Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ ehthumbs.db
Thumbs.db

# Other
HOWTO.md
HOWTO.md
TODO.md
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Have an idea for a new feature? We'd love to hear it. [Open an issue](https://gi

### Pull Requests for Code Changes

1. Fork the repository and create a new branch from `main`.
1. Fork the repository and create a new branch from `develop`.
2. Make your changes, adhering to the existing code style.
3. Ensure the project builds successfully using the command below.
4. Submit a pull request with a clear description of your changes and why they are needed.
Expand Down
418 changes: 242 additions & 176 deletions LICENSE

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Eclipse Themes

[![Build Status](https://github.com/ahatem/eclipse-themes-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/ahatem/eclipse-themes-plugin/actions)
[![License: EPL-2.0](https://img.shields.io/badge/License-EPL--2.0-brightgreen.svg)](https://opensource.org/licenses/EPL-2.0)
![Eclipse Marketplace License](https://img.shields.io/eclipse-marketplace/l/eclipse-themes?color=brightgreen)
![Eclipse Marketplace Last Update](https://img.shields.io/eclipse-marketplace/v/eclipse-themes)
![Eclipse Marketplace Downloads](https://img.shields.io/eclipse-marketplace/dt/eclipse-themes)


A simple plugin for finding and applying editor color themes in the Eclipse IDE.

Expand All @@ -24,6 +27,12 @@ I then realized the old plugin was also outdated, so I decided to build this one

## 🚀 Installation

### From the Eclipse Marketplace (Recommended)

1. Go to `Help -> Eclipse Marketplace...`.
2. Search for `Eclipse Themes`.
3. Click **Install**.

### From the Update Site

1. Go to `Help -> Install New Software...`.
Expand All @@ -33,7 +42,7 @@ I then realized the old plugin was also outdated, so I decided to build this one
## 💻 Usage

1. Go to `Window -> Preferences` (or `Eclipse -> Settings...` on macOS).
2. Navigate to `General -> Appearance -> Editor Themes`.
2. Navigate to `General -> Appearance -> Eclipse Themes`.
3. Pick a theme from the list to see how it looks.
4. Click **Apply and Close** to set your new editor theme.

Expand Down
2 changes: 1 addition & 1 deletion bundles/com.github.eclipsethemes/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse Themes
Bundle-SymbolicName: com.github.eclipsethemes;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.github.eclipsethemes.EclipseThemes
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui
Expand Down
4 changes: 0 additions & 4 deletions bundles/com.github.eclipsethemes/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<adapter
class="com.github.eclipsethemes.eclipse.adapters.editor.TextEditorThemeAdapter" plugin="org.eclipse.ui.editors"></adapter>
<adapter
class="com.github.eclipsethemes.eclipse.adapters.editor.GenericEditorThemeAdapter"
plugin="org.eclipse.ui.genericeditor"></adapter>
<adapter
class="com.github.eclipsethemes.eclipse.adapters.ui.DebugConsoleThemeAdapter"
plugin="org.eclipse.debug.ui"></adapter>
<adapter
Expand All @@ -35,6 +32,5 @@
<adapter
class="com.github.eclipsethemes.eclipse.adapters.editor.AntEditorThemeAdapter"
plugin="org.eclipse.ant.ui"></adapter>

</extension>
</plugin>
26 changes: 13 additions & 13 deletions bundles/com.github.eclipsethemes/pom.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.eclipsethemes</groupId>
<artifactId>eclipse-themes-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<parent>
<groupId>com.github.eclipsethemes</groupId>
<artifactId>eclipse-themes-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>com.github.eclipsethemes</artifactId>
<packaging>eclipse-plugin</packaging>
<artifactId>com.github.eclipsethemes</artifactId>
<packaging>eclipse-plugin</packaging>

<name>Eclipse Themes Plugin</name>
<description>Color themes for Eclipse editors</description>
<name>Eclipse Themes Plugin</name>
<description>Color themes for Eclipse editors</description>
</project>
Original file line number Diff line number Diff line change
@@ -1,91 +1,95 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="com.github.eclipsethemes" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="com.github.eclipsethemes" id="com.github.eclipsethemes.theme.adapters"
name="Theme Adapter" />
</appinfo>
<documentation> Used to create adapters to allow theming other plugins. </documentation>
</annotation>
<schema targetNamespace="com.github.eclipsethemes"
xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="com.github.eclipsethemes"
id="com.github.eclipsethemes.theme.adapters"
name="Theme Adapter" />
</appinfo>
<documentation> Used to create adapters to allow theming other plugins. </documentation>
</annotation>

<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="adapter" minOccurs="1" maxOccurs="unbounded" />
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation> </documentation>
<appinfo>
<meta.attribute translatable="true" />
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="adapter" minOccurs="1" maxOccurs="unbounded" />
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation> </documentation>
<appinfo>
<meta.attribute translatable="true" />
</appinfo>
</annotation>
</attribute>
</complexType>
</element>

<element name="adapter">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation> </documentation>
<appinfo>
<meta.attribute kind="java"
basedOn="com.github.eclipsethemes.eclipse.adapters.EclipseThemeAdapter:" />
</appinfo>
</annotation>
</attribute>
<attribute name="plugin" type="string">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="adapter">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation> </documentation>
<appinfo>
<meta.attribute kind="java"
basedOn="com.github.eclipsethemes.eclipse.adapters.EclipseThemeAdapter:" />
</appinfo>
</annotation>
</attribute>
<attribute name="plugin" type="string">
<annotation>
<documentation> </documentation>
</annotation>
</attribute>
</complexType>
</element>

<annotation>
<appinfo>
<meta.section type="since" />
</appinfo>
<documentation> [Enter the first release in which this extension point appears.] </documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="since" />
</appinfo>
<documentation> [Enter the first release in which this extension point
appears.] </documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="examples" />
</appinfo>
<documentation> [Enter extension point usage example here.] </documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples" />
</appinfo>
<documentation> [Enter extension point usage example here.] </documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="apiinfo" />
</appinfo>
<documentation> [Enter API information here.] </documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo" />
</appinfo>
<documentation> [Enter API information here.] </documentation>
</annotation>

<annotation>
<appinfo>
<meta.section type="implementation" />
</appinfo>
<documentation> [Enter information about supplied implementation of this extension point.] </documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation" />
</appinfo>
<documentation> [Enter information about supplied implementation of this
extension point.] </documentation>
</annotation>


</schema>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class EclipseThemes extends AbstractUIPlugin {

public ThemeManager getManager() {
if (this.themeManager == null) {
this.themeManager = new ThemeManager();
this.themeManager = new ThemeManager(getLogger());
}

return this.themeManager;
Expand All @@ -46,12 +46,12 @@ public static EclipseThemes instance() {
}

public ILog getLogger() {
if (pluginLog == null) {
Bundle bundle = getBundle();
pluginLog = Platform.getLog(bundle);
}
return pluginLog;
}
if (pluginLog == null) {
Bundle bundle = getBundle();
pluginLog = Platform.getLog(bundle);
}
return pluginLog;
}

public static File getPluginDataDirectory() {
Bundle bundle = FrameworkUtil.getBundle(EclipseThemes.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
* An immutable, type-safe representation of a color. Use the static factory
* methods like Color.ofHex() or Color.ofRgb() to create instances.
*/
public final class Color {
public record Color(int red, int green, int blue) {

public static final Color BLACK = new Color(0, 0, 0);
public static final Color WHITE = new Color(255, 255, 255);

private final int red;
private final int green;
private final int blue;

private Color(int red, int green, int blue) {
this.red = red;
this.green = green;
this.blue = blue;
public Color {
if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255) {
throw new IllegalArgumentException(
String.format("Invalid RGB value: r=%d, g=%d, b=%d", red, green, blue));
}
}

public static Color ofHex(String hex) {
Expand Down Expand Up @@ -49,52 +46,15 @@ public static Color ofHex(String hex) {
}

public static Color ofRgb(int red, int green, int blue) {
if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255) {
throw new IllegalArgumentException(String.format("Invalid RGB value: r=%d, g=%d, b=%d", red, green, blue));
}

// Example of using our cache
if (red == 0 && green == 0 && blue == 0)
return BLACK;
if (red == 255 && green == 255 && blue == 255)
return WHITE;

return new Color(red, green, blue);
}

public int getRed() {
return this.red;
}

public int getGreen() {
return this.green;
}

public int getBlue() {
return this.blue;
}

public String toEclipseFormat() {
return String.format("%d,%d,%d", red, green, blue);
}

@Override
public String toString() {
return String.format("#%02x%02x%02x", this.red, this.green, this.blue);
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Color color = (Color) o;
return red == color.red && green == color.green && blue == color.blue;
}

@Override
public int hashCode() {
return Objects.hash(red, green, blue);
return String.format("#%02x%02x%02x", red, green, blue);
}
}
Loading
Loading