#1485 Improved skins support, night mode

This commit is contained in:
Jindra Petřík
2021-04-07 22:23:29 +02:00
parent 211aa60011
commit 6e0b35c06b
17 changed files with 170 additions and 29 deletions

View File

@@ -19,7 +19,9 @@ package com.jpexs.decompiler.flash.gui;
import java.awt.Color;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.event.HyperlinkEvent;
import javax.swing.text.html.HTMLDocument;
public class HtmlLabel extends JEditorPane {
@@ -53,6 +55,10 @@ public class HtmlLabel extends JEditorPane {
}
this.rawText = t;
super.setText(modText);
String aRule = "a {color: " + getUIColorToHex("List.selectionBackground") + "}";
((HTMLDocument) getDocument()).getStyleSheet().addRule(aRule);
}
@Override
@@ -60,4 +66,9 @@ public class HtmlLabel extends JEditorPane {
return rawText;
}
private static String getUIColorToHex(String name) {
Color c = UIManager.getColor(name);
return String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
}
}