Search code examples
macoscocoanstextfieldappkitnsattributedstring

NSTextField clicked link colour


I have an NSTextField that contains an NSAttributedString which itself contains a clickable link.

I've change the colour of the link for my own styling, however when I click on it it becomes blue and underlined. How can I stop this?


Solution

  • Seems that I'm not the only one with this problem, and there's a handy class to solve it:

    https://github.com/laevandus/NSTextFieldHyperlinks

    https://github.com/catlan/DSClickableURLTextField