Dark Mode and HTML Links

Product: PowerShell Universal
Version: 2.7.2

I have really struggled trying to figure out how to change the color of links when in dark mode. I’m creating the links in a UDTable using this code:

New-UDTooltip -TooltipContent { "View Move Info" } -Content {
                    New-UDHtml -Markup "<a href=""/om/Moves/$($EventData.OMMoveID)"" >$($EventData.OMMoveID)</a>" #target=""_blank""

                }

Here is how it looks in dark mode:
image

I’ve tried adding a css file like this:

a {

color: '#42a5f5'

}

a:visited {

color: '#42a5f5' !important

}

But, this doesn’t seem to make any difference. Anyone have any suggestions on how to fix this?

Thanks!

1 Like

I’d suggest using UDLink rather than UDHtml. This may work.

  New-UDTooltip -TooltipContent { "View Move Info" } -Content {
      New-UDLink -Url "/om/Moves/$($EventData.OMMoveID)" -Text 'hello' -Style @{
         color = '#42a5f5'
      } -OpenInNewWindow
    }

image

OK. I think that works in this situation. The other situation I have is that I do use New-UDHTML because I store notes on these items in HTML format. Some of those notes will include tags, and those are hard to read as I can’t figure out the style to use in this situation.

Here’s the HTML generated by New-UDLink. If you can apply some of those class names to your link it should have the same colors.

<a class="MuiTypography-root MuiLink-root MuiLink-underlineNone ud-mu-link MuiTypography-colorPrimary" id="2d967abb-b09c-466e-9fec-3e408d38b264" href="/om/Moves/" rel="noopener" target="_blank" style="color: rgb(66, 165, 245);">hello</a>
1 Like