vrrathod
vrrathod

Reputation: 1240

NSMutableAttributedString overrides NSForegroundcolor when NSLinkAttributeName

I have a working NSTextView. It does show some text and when it sees a URL, it shows a hyperlink with blue foreground color. So far so good.

Now I am interested in showing a custom color for the URL. So I am setting another attribute NSForegroundcolor. I noticed that when I set NSLinkAttributeName, it will always override the custom color with default blue color. If I remove the NSLinkAttributeName, it will show the link with the custom color. As soon as I add NSLinkAttributeName back, it turns back to default blue.

Upvotes: 3

Views: 768

Answers (1)

lhunath
lhunath

Reputation: 125376

Set the NSTextView's linkTextAttributes to your foreground color.

Upvotes: 1

Related Questions