mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
fix black text in GUI on gnome desktops
This commit is contained in:
@@ -246,10 +246,10 @@ index c42a9949c4d37d45883867a54222a7ab33944b39..7f07ffab0835d45d4d170fe171d7fa99
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/gui/GUIColor.java b/src/main/java/org/purpurmc/purpur/gui/GUIColor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567cd93c17e
|
||||
index 0000000000000000000000000000000000000000..550222758bf0e7deff26a6e813a860b7be365e87
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/gui/GUIColor.java
|
||||
@@ -0,0 +1,54 @@
|
||||
@@ -0,0 +1,58 @@
|
||||
+package org.purpurmc.purpur.gui;
|
||||
+
|
||||
+import net.md_5.bungee.api.ChatColor;
|
||||
@@ -290,6 +290,10 @@ index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567
|
||||
+ return color;
|
||||
+ }
|
||||
+
|
||||
+ public ChatColor getChatColor() {
|
||||
+ return chat;
|
||||
+ }
|
||||
+
|
||||
+ public String getCode() {
|
||||
+ return chat.toString();
|
||||
+ }
|
||||
@@ -306,14 +310,14 @@ index 0000000000000000000000000000000000000000..0f2e7e0b81620c8581949bd5f0bdb567
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java b/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..33e89b4c00fa8318506b36cbe49fe4e412e0a9a1
|
||||
index 0000000000000000000000000000000000000000..d75fb5e77eff27d86135ed7d605dbc250b660f7d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/gui/JColorTextPane.java
|
||||
@@ -0,0 +1,78 @@
|
||||
@@ -0,0 +1,83 @@
|
||||
+package org.purpurmc.purpur.gui;
|
||||
+
|
||||
+import com.google.common.collect.Sets;
|
||||
+import net.md_5.bungee.api.ChatColor;
|
||||
+import javax.swing.UIManager;
|
||||
+import net.md_5.bungee.api.chat.BaseComponent;
|
||||
+import net.md_5.bungee.api.chat.TextComponent;
|
||||
+
|
||||
@@ -327,11 +331,16 @@ index 0000000000000000000000000000000000000000..33e89b4c00fa8318506b36cbe49fe4e4
|
||||
+import java.util.Set;
|
||||
+
|
||||
+public class JColorTextPane extends JTextPane {
|
||||
+ private static final GUIColor DEFAULT_COLOR = GUIColor.BLACK;
|
||||
+ private static final GUIColor DEFAULT_COLOR;
|
||||
+ static {
|
||||
+ DEFAULT_COLOR = UIManager.getSystemLookAndFeelClassName().equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")
|
||||
+ ? GUIColor.WHITE : GUIColor.BLACK;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public void append(String msg) {
|
||||
+ // TODO: update to use adventure instead
|
||||
+ BaseComponent[] components = TextComponent.fromLegacyText(DEFAULT_COLOR.getCode() + msg, ChatColor.BLACK);
|
||||
+ BaseComponent[] components = TextComponent.fromLegacyText(DEFAULT_COLOR.getCode() + msg, DEFAULT_COLOR.getChatColor());
|
||||
+ for (BaseComponent component : components) {
|
||||
+ String text = component.toPlainText();
|
||||
+ if (text == null || text.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user