Skip to content

Commit 7151146

Browse files
committed
Add a public property for text color
1 parent 492791e commit 7151146

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Aztec/Classes/TextKit/HTMLStorage.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ open class HTMLStorage: NSTextStorage {
1515
///
1616
open var font: UIFont
1717

18+
/// Color to be applied over HTML text
19+
///
20+
open var textColor = Styles.defaultTextColor
21+
1822
/// Color to be applied over HTML Comments
1923
///
2024
open var commentColor = Styles.defaultCommentColor
@@ -124,7 +128,7 @@ private extension HTMLStorage {
124128
func colorizeHTML() {
125129
let fullStringRange = rangeOfEntireString
126130

127-
removeAttribute(.foregroundColor, range: fullStringRange)
131+
addAttribute(.foregroundColor, value: textColor, range: fullStringRange)
128132
addAttribute(.font, value: font, range: fullStringRange)
129133

130134
let tags = RegExes.html.matches(in: string, options: [], range: fullStringRange)
@@ -164,6 +168,7 @@ extension HTMLStorage {
164168
/// Default Styles
165169
///
166170
public struct Styles {
171+
static let defaultTextColor = UIColor.black
167172
static let defaultCommentColor = UIColor.lightGray
168173
static let defaultTagColor = UIColor(red: 0x00/255.0, green: 0x75/255.0, blue: 0xB6/255.0, alpha: 0xFF/255.0)
169174
static let defaultQuotedColor = UIColor(red: 0x6E/255.0, green: 0x96/255.0, blue: 0xB1/255.0, alpha: 0xFF/255.0)

0 commit comments

Comments
 (0)