Skip to content

Commit 6c4e208

Browse files
Merge pull request #1198 from wordpress-mobile/issue/allow_configuration_of_text_color
Allow configuration of text color
2 parents 446bca5 + bfcc9a5 commit 6c4e208

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Aztec/Classes/TextKit/TextView.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ open class TextView: UITextView {
226226
var defaultMissingImage: UIImage
227227

228228
fileprivate var defaultAttributes: [NSAttributedString.Key: Any] {
229-
let attributes: [NSAttributedString.Key: Any] = [
229+
var attributes: [NSAttributedString.Key: Any] = [
230230
.font: defaultFont,
231-
.paragraphStyle: defaultParagraphStyle
231+
.paragraphStyle: defaultParagraphStyle,
232232
]
233-
233+
if let color = textColor {
234+
attributes[.foregroundColor] = color
235+
}
234236
return attributes
235237
}
236238

Example/Example/EditorDemoController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ class EditorDemoController: UIViewController {
324324
textView.accessibilityLabel = accessibilityLabel
325325
textView.font = Constants.defaultContentFont
326326
textView.keyboardDismissMode = .interactive
327-
textView.textColor = UIColor.darkText
327+
textView.textColor = UIColor(red: 0x1A/255.0, green: 0x1A/255.0, blue: 0x1A/255.0, alpha: 1)
328+
textView.linkTextAttributes = [.foregroundColor: UIColor(red: 0x01 / 255.0, green: 0x60 / 255.0, blue: 0x87 / 255.0, alpha: 1), NSAttributedString.Key.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue)]
328329
}
329330

330331
private func registerAttachmentImageProviders() {

0 commit comments

Comments
 (0)