File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,13 @@ extension TagTransformer {
1818}
1919
2020extension String {
21- var styledAttributedString : NSAttributedString {
21+ func styledAttributedString( textColor : Color ) -> NSAttributedString {
2222 let paragraphStyle = NSMutableParagraphStyle ( )
2323 paragraphStyle. paragraphSpacing = 8
2424 let systemFontSize = NSFont . systemFontSize ( for: . regular)
2525 let all = Style
2626 . font ( . systemFont( ofSize: systemFontSize) )
27+ . foregroundColor ( textColor)
2728 . paragraphStyle ( paragraphStyle)
2829 let a = Style ( " a " )
2930 let i = Style ( " i " )
Original file line number Diff line number Diff line change @@ -56,7 +56,14 @@ class CommentCellView: NSTableCellView {
5656 }
5757 }
5858 authorLabel. stringValue = comment. author
59- textLabel. attributedStringValue = comment. text. styledAttributedString
59+ let textColor : NSColor
60+ switch comment. color {
61+ case . c00: textColor = . labelColor
62+ case . c5a, . c73, . c82: textColor = . secondaryLabelColor
63+ case . c88, . c9c, . cae: textColor = . tertiaryLabelColor
64+ case . cbe, . cce, . cdd: textColor = . quaternaryLabelColor
65+ }
66+ textLabel. attributedStringValue = comment. text. styledAttributedString ( textColor: textColor)
6067 creationLabel. stringValue = formatter. localizedString ( for: comment. creation, relativeTo: Date ( ) )
6168 }
6269
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class ItemViewController: NSViewController {
3030 urlButton. isHidden = false
3131 urlButton. title = host
3232 } else if let text = story. content. text {
33- textLabel. attributedStringValue = text. styledAttributedString
33+ textLabel. attributedStringValue = text. styledAttributedString ( textColor : . labelColor )
3434 textScrollView. isHidden = false
3535 urlButton. isHidden = true
3636 } else {
You can’t perform that action at this time.
0 commit comments