Changeset 17117 in josm


Ignore:
Timestamp:
2020-10-08T20:26:00+02:00 (4 years ago)
Author:
simon04
Message:

see #19819 - Obtain link color using UIManager (patch by DevCharly)

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r16973 r17117  
    5757            + "body {font-family: sans-serif; font-weight: bold; }\n"
    5858            + "h1 {text-align: center; }\n"
    59             + "a {color: #316ed9; }\n"
     59            + "a {color: " + JosmEditorPane.getLinkColor("#316ed9") + "; }\n"
    6060            + ".icon {font-size: 0; }\n"
    6161            + "</style>\n";
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r16149 r17117  
    136136        }
    137137        ss.addRule(css);
     138
     139        // overwrite link color
     140        String linkColor = JosmEditorPane.getLinkColor(null);
     141        if (linkColor != null) {
     142            ss.addRule("a {color: " + linkColor + "}");
     143        }
    138144        return ss;
    139145    }
  • trunk/src/org/openstreetmap/josm/gui/widgets/HtmlPanel.java

    r14726 r17117  
    5757                f.isItalic() ? "italic" : "normal"
    5858        ) + '}');
    59         ss.addRule("a {text-decoration: underline; color: blue}");
     59        ss.addRule("a {text-decoration: underline; color: " + JosmEditorPane.getLinkColor("blue") + "}");
    6060        ss.addRule("ul {margin-left: 1cm; list-style-type: disc}");
    6161        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java

    r14463 r17117  
    1616
    1717import org.openstreetmap.josm.gui.util.GuiHelper;
     18import org.openstreetmap.josm.tools.ColorHelper;
    1819import org.openstreetmap.josm.tools.Destroyable;
    1920import org.openstreetmap.josm.tools.HttpClient;
     
    101102        final StyleSheet ss = new StyleSheet();
    102103        ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + '}');
    103         ss.addRule("a {text-decoration: underline; color: blue}");
     104        ss.addRule("a {text-decoration: underline; color: " + getLinkColor("blue") + "}");
    104105        ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + '}');
    105106        ss.addRule("ol {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: decimal}");
     
    141142    }
    142143
     144    /**
     145     * Returns the color (in CSS format) that should be used for links.
     146     * If the current look and feel does not provide a link color, the passed default color is used.
     147     * @param defaultColor the default color
     148     * @return link color
     149     */
     150    public static String getLinkColor(String defaultColor) {
     151        Color color = UIManager.getColor("Component.linkColor");
     152        return color != null ? ColorHelper.color2html(color) : defaultColor;
     153    }
     154
    143155    @Override
    144156    public void destroy() {
Note: See TracChangeset for help on using the changeset viewer.