From 7bca26f1466ddbaea3f309f60922b3af6231cad8 Mon Sep 17 00:00:00 2001
From: Kyle <48519776+xKylee@users.noreply.github.com>
Date: Tue, 5 Jan 2021 05:57:49 +0000
Subject: [PATCH] various: fixes (#2893)
change brand colour to blue from orange.
change star colour to blue.
change config on toggle to blue.
change runelite logo to openosrs.
---
.../java/net/runelite/client/Notifier.java | 2 +-
.../client/plugins/config/ConfigPanel.java | 2 +-
.../client/plugins/config/PluginListItem.java | 6 +--
.../plugins/config/PluginToggleButton.java | 3 +-
.../java/net/runelite/client/ui/ClientUI.java | 4 +-
.../net/runelite/client/ui/SplashScreen.java | 4 +-
.../client/ui/components/FlatTextField.java | 4 +-
.../components/materialtabs/MaterialTab.java | 4 +-
.../net/runelite/client/util/ImageUtil.java | 52 +++++++++++++++++++
.../net/runelite/client/util/SwingUtil.java | 6 +--
10 files changed, 70 insertions(+), 17 deletions(-)
diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java
index 8184cf9f98..30a9ad4c3b 100644
--- a/runelite-client/src/main/java/net/runelite/client/Notifier.java
+++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java
@@ -380,7 +380,7 @@ public class Notifier
{
if (OSType.getOSType() == OSType.Linux && !Files.exists(notifyIconPath))
{
- try (InputStream stream = Notifier.class.getResourceAsStream("/runelite.png"))
+ try (InputStream stream = Notifier.class.getResourceAsStream("/openosrs.png"))
{
Files.copy(stream, notifyIconPath);
}
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java
index 278864ea15..cf8ad996f9 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java
@@ -285,7 +285,7 @@ class ConfigPanel extends PluginPanel
String name = cs.name();
final JLabel sectionName = new JLabel(name);
- sectionName.setForeground(ColorScheme.BRAND_ORANGE);
+ sectionName.setForeground(ColorScheme.BRAND_BLUE);
sectionName.setFont(FontManager.getRunescapeBoldFont());
sectionName.setToolTipText("" + name + ":
" + cs.description() + "");
sectionHeader.add(sectionName, BorderLayout.CENTER);
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java
index c71bcc8788..bc3bae3cc4 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java
@@ -76,7 +76,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
BufferedImage configIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_edit_icon.png");
BufferedImage onStar = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "star_on.png");
CONFIG_ICON = new ImageIcon(configIcon);
- ON_STAR = new ImageIcon(onStar);
+ ON_STAR = new ImageIcon(ImageUtil.recolorImage(onStar, ColorScheme.BRAND_BLUE));
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(configIcon, -100));
BufferedImage offStar = ImageUtil.luminanceScale(
@@ -216,7 +216,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
}
/**
- * Adds a mouseover effect to change the text of the passed label to {@link ColorScheme#BRAND_ORANGE} color, and
+ * Adds a mouseover effect to change the text of the passed label to {@link ColorScheme#BRAND_BLUE} color, and
* adds the passed menu items to a popup menu shown when the label is clicked.
*
* @param label The label to attach the mouseover and click effects to
@@ -258,7 +258,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
public void mouseEntered(MouseEvent mouseEvent)
{
lastForeground = label.getForeground();
- label.setForeground(ColorScheme.BRAND_ORANGE);
+ label.setForeground(ColorScheme.BRAND_BLUE);
}
@Override
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java
index a2eb72719f..c6e5ffa177 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginToggleButton.java
@@ -29,6 +29,7 @@ import java.awt.Dimension;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JToggleButton;
+import net.runelite.client.ui.ColorScheme;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.SwingUtil;
@@ -40,7 +41,7 @@ class PluginToggleButton extends JToggleButton
static
{
BufferedImage onSwitcher = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "switcher_on.png");
- ON_SWITCHER = new ImageIcon(onSwitcher);
+ ON_SWITCHER = new ImageIcon(ImageUtil.recolorImage(onSwitcher, ColorScheme.BRAND_BLUE));
OFF_SWITCHER = new ImageIcon(ImageUtil.flipImage(
ImageUtil.luminanceScale(
ImageUtil.grayscaleImage(onSwitcher),
diff --git a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
index 9223b82fb1..b145ab8496 100644
--- a/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
+++ b/runelite-client/src/main/java/net/runelite/client/ui/ClientUI.java
@@ -108,7 +108,7 @@ public class ClientUI
private static final String CONFIG_CLIENT_BOUNDS = "clientBounds";
private static final String CONFIG_CLIENT_MAXIMIZED = "clientMaximized";
private static final String CONFIG_CLIENT_SIDEBAR_CLOSED = "clientSidebarClosed";
- public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png");
+ public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/openosrs.png");
@Getter
private TrayIcon trayIcon;
@@ -1121,4 +1121,4 @@ public class ClientUI
configManager.setConfiguration(CONFIG_GROUP, CONFIG_CLIENT_BOUNDS, bounds);
}
}
-}
\ No newline at end of file
+}
diff --git a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java
index ad5e2325ed..2163e7b491 100644
--- a/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java
+++ b/runelite-client/src/main/java/net/runelite/client/ui/SplashScreen.java
@@ -96,8 +96,8 @@ public class SplashScreen extends JFrame implements ActionListener
y += action.getHeight() + PAD;
pane.add(progress);
- progress.setForeground(ColorScheme.BRAND_ORANGE);
- progress.setBackground(ColorScheme.BRAND_ORANGE.darker().darker());
+ progress.setForeground(ColorScheme.BRAND_BLUE);
+ progress.setBackground(ColorScheme.BRAND_BLUE.darker().darker());
progress.setBorder(new EmptyBorder(0, 0, 0, 0));
progress.setBounds(0, y, WIDTH, 14);
progress.setFont(font);
diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java b/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java
index 1c13cad475..45da76e59b 100644
--- a/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java
+++ b/runelite-client/src/main/java/net/runelite/client/ui/components/FlatTextField.java
@@ -67,7 +67,7 @@ public class FlatTextField extends JPanel
this.textField.setBorder(null);
this.textField.setOpaque(false);
this.textField.setSelectedTextColor(Color.WHITE);
- this.textField.setSelectionColor(ColorScheme.BRAND_ORANGE_TRANSPARENT);
+ this.textField.setSelectionColor(ColorScheme.BRAND_BLUE_TRANSPARENT);
add(textField, BorderLayout.CENTER);
@@ -175,4 +175,4 @@ public class FlatTextField extends JPanel
return textField.getDocument();
}
-}
\ No newline at end of file
+}
diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java
index 9ba4fe0463..acda1af185 100644
--- a/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java
+++ b/runelite-client/src/main/java/net/runelite/client/ui/components/materialtabs/MaterialTab.java
@@ -51,7 +51,7 @@ import net.runelite.client.ui.ColorScheme;
public class MaterialTab extends JLabel
{
private static final Border SELECTED_BORDER = new CompoundBorder(
- BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.BRAND_ORANGE),
+ BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.BRAND_BLUE),
BorderFactory.createEmptyBorder(5, 10, 4, 10));
private static final Border UNSELECTED_BORDER = BorderFactory
@@ -165,4 +165,4 @@ public class MaterialTab extends JLabel
setForeground(Color.GRAY);
selected = false;
}
-}
\ No newline at end of file
+}
diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java
index 66e9930ab5..9c04a15d33 100644
--- a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java
+++ b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java
@@ -34,10 +34,12 @@ import java.awt.image.BufferedImage;
import java.awt.image.DirectColorModel;
import java.awt.image.PixelGrabber;
import java.awt.image.RescaleOp;
+import java.awt.image.WritableRaster;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.function.Predicate;
import javax.imageio.ImageIO;
import javax.swing.GrayFilter;
import lombok.extern.slf4j.Slf4j;
@@ -398,6 +400,56 @@ public class ImageUtil
return filledImage;
}
+ /**
+ * Recolors pixels of the given image with the given color based on a given recolor condition
+ * predicate.
+ *
+ * @param image The image which should have its non-transparent pixels recolored.
+ * @param color The color with which to recolor pixels.
+ * @param recolorCondition The condition on which to recolor pixels with the given color.
+ * @return The given image with all pixels fulfilling the recolor condition predicate
+ * set to the given color.
+ */
+ public static BufferedImage recolorImage(final BufferedImage image, final Color color, final Predicate recolorCondition)
+ {
+ final BufferedImage recoloredImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
+ for (int x = 0; x < recoloredImage.getWidth(); x++)
+ {
+ for (int y = 0; y < recoloredImage.getHeight(); y++)
+ {
+ final Color pixelColor = new Color(image.getRGB(x, y), true);
+ if (!recolorCondition.test(pixelColor))
+ {
+ recoloredImage.setRGB(x, y, image.getRGB(x, y));
+ continue;
+ }
+
+ recoloredImage.setRGB(x, y, color.getRGB());
+ }
+ }
+ return recoloredImage;
+ }
+
+ public static BufferedImage recolorImage(BufferedImage image, final Color color)
+ {
+ int width = image.getWidth();
+ int height = image.getHeight();
+ WritableRaster raster = image.getRaster();
+
+ for (int xx = 0; xx < width; xx++)
+ {
+ for (int yy = 0; yy < height; yy++)
+ {
+ int[] pixels = raster.getPixel(xx, yy, (int[]) null);
+ pixels[0] = color.getRed();
+ pixels[1] = color.getGreen();
+ pixels[2] = color.getBlue();
+ raster.setPixel(xx, yy, pixels);
+ }
+ }
+ return image;
+ }
+
/**
* Performs a rescale operation on the image's color components.
*
diff --git a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java
index 90723d9ade..5f226a40c9 100644
--- a/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java
+++ b/runelite-client/src/main/java/net/runelite/client/util/SwingUtil.java
@@ -83,11 +83,11 @@ public class SwingUtil
UIManager.put("MenuItem.foreground", Color.WHITE);
UIManager.put("Panel.background", ColorScheme.DARK_GRAY_COLOR);
UIManager.put("ScrollBarUI", CustomScrollBarUI.class.getName());
- UIManager.put("TextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
+ UIManager.put("TextField.selectionBackground", ColorScheme.BRAND_BLUE_TRANSPARENT);
UIManager.put("TextField.selectionForeground", Color.WHITE);
- UIManager.put("FormattedTextField.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
+ UIManager.put("FormattedTextField.selectionBackground", ColorScheme.BRAND_BLUE_TRANSPARENT);
UIManager.put("FormattedTextField.selectionForeground", Color.WHITE);
- UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_ORANGE_TRANSPARENT);
+ UIManager.put("TextArea.selectionBackground", ColorScheme.BRAND_BLUE_TRANSPARENT);
UIManager.put("TextArea.selectionForeground", Color.WHITE);
// Do not render shadows under popups/tooltips.