diff --git a/CHANGELOG.md b/CHANGELOG.md index cb17ac957..cfefe4b92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ All notable changes to this project will be documented in this file. - Raw editor does not select item in enum list - Sound not played on frames - [#1678] Miter clip join - can be enabled in Settings +- Html label links visibility ### Changed - Full path inside bundle is displayed as SWF name instead simple name diff --git a/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java b/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java index c84e56c4b..67d880638 100644 --- a/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java +++ b/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java @@ -25,7 +25,7 @@ import javax.swing.text.html.HTMLDocument; public class HtmlLabel extends JEditorPane { - private JLabel label = new JLabel(); + private final JLabel label = new JLabel(); private String rawText; public HtmlLabel() { @@ -56,7 +56,16 @@ public class HtmlLabel extends JEditorPane { this.rawText = t; super.setText(modText); - String aRule = "a {color: " + getUIColorToHex("List.selectionBackground") + "}"; + Color bgColor = UIManager.getColor("Panel.background"); + int light = (bgColor.getRed() + bgColor.getGreen() + bgColor.getBlue()) / 3; + boolean nightMode = light <= 128; + + Color linkColor = Color.blue; + if (nightMode) { + linkColor = new Color(0x88, 0x88, 0xff); + } + + String aRule = "a {color: " + String.format("#%02x%02x%02x", linkColor.getRed(), linkColor.getGreen(), linkColor.getBlue()) + "}"; ((HTMLDocument) getDocument()).getStyleSheet().addRule(aRule); } @@ -65,10 +74,4 @@ public class HtmlLabel extends JEditorPane { public String getText() { 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()); - } - }