Search code examples
wxwidgetswxhtmlwindow

How to set color of link in wxWidgets wxHtmlWindow?


The wxWidgets library includes a simple HTML parser and viewer, which I'm trying to use to display some simple HTML. I'd like to make certain links (the ones that go to items that don't yet exist) a different color, or otherwise indicate that they need to be created, but I don't see any obvious way to do so.

Does anyone know of a way to do this?


Solution

  • Use the color CSS Style for span (Something like <a href="#"><span style='color:red;'>Red Link</span></a>). Here is a quote from class' documentation here

    List of supported styles

    wxHTML doesn't really have CSS support but it does support a few simple styles: you can use "text-align", "width", "vertical-align" and "background" with all elements and for SPAN elements a few other styles are additionally recognized:

    color
    font-family
    font-size (only in point units)
    font-style (only "oblique", "italic" and "normal" values are supported)
    font-weight (only "bold" and "normal" values are supported)
    text-decoration (only "underline" value is supported)
    

    See: https://docs.wxwidgets.org/3.1/overview_html.html