Closed adamdahan closed 4 years ago
I am also seeing a similar issue, but my links are always blue, even when setting
CMTextAttributes *cmAttrs = [[CMTextAttributes alloc] init];
cmAttrs.linkAttributes = @{NSForegroundColorAttributeName: [UIColor fp_pink]};
@adamdahan While I wish I could resolve every issue in a timely manner, I realistically cannot when I have other things to prioritize. I don't have any obligation or incentive to put this ahead of anything else. It's open source for a reason: you can read, extend, and modify the code on your own to suit your purposes rather than waiting on me to fix it for you.
@ryang1428 It looks like this may be an issue with a behavioural change in UIKit, I will investigate soon.
To anyone who still struggles with this issue - try setting NSTextView/UITextView linkTextAttribues
to an empty dictionary and set all the needed attributes through CMTextAttributes linkAttributes
.
In my case the link always stayed blue. It appears as though the view overrides attributed string's attributes.
@anton-barkov Thanks for the tips! Any idea how to do the same for NSTextField?
@ianbytchek I'm not sure that links will work properly with NSTextField, you should probably consider using NSTextView. See this thread.
@anton-barkov They work perfectly fine. The only issue is they are always displayed in blue while the attributed string specifies a different color.
The conclusion here seems to be that the view being used to render the attributed string seems to override attributes that are set by CocoaMarkdown when generating the attributed string. Since this is a UIKit problem and not an issue with CMAttributedStringRenderer
, I am closing this issue.
let attributes = CMTextAttributes() attributes.linkAttributes = [ NSForegroundColorAttributeName: UIColor.redColor() ]
Will render white links if the window.tintColor property is set...
Aside from that the code above actually doesn't work at all. Starting to think the external tints colors are causing this issue?
Any solid explanation why?