@@ -52,8 +52,6 @@ class EditView: NSView {
5252
5353 override func draw( _ dirtyRect: NSRect ) {
5454 guard let lines = lineSource, lines. totalLines > 0 else { return }
55- NSColor . white. setFill ( )
56- dirtyRect. fill ( )
5755
5856 let font = EditorPreferences . shared. editorFont
5957 let linespace = font. linespace
@@ -65,7 +63,7 @@ class EditView: NSView {
6563
6664 for lineNumber in first..< last {
6765 let line = lines. getLine ( line: UInt32 ( lineNumber) ) ?? RawLine . placeholder ( )
68- let attrString = NSMutableAttributedString ( string: line. text, attributes: [ . font: font, . foregroundColor: NSColor . black ] )
66+ let attrString = NSMutableAttributedString ( string: line. text, attributes: [ . font: font, . foregroundColor: NSColor . textColor ] )
6967
7068 for styleSpan in line. styles {
7169 let range = NSRange ( location: styleSpan. start, length: styleSpan. len)
@@ -93,7 +91,7 @@ class EditView: NSView {
9391 let path = NSBezierPath ( )
9492 path. move ( to: NSPoint ( x: X_OFFSET + cursorPos, y: selY) )
9593 path. line ( to: NSPoint ( x: X_OFFSET + cursorPos, y: selY + linespace) )
96- NSColor . black . setStroke ( )
94+ NSColor . textColor . setStroke ( )
9795 path. stroke ( )
9896 }
9997
@@ -229,7 +227,8 @@ extension NSMutableAttributedString {
229227
230228 var attrs = [ NSAttributedString . Key : Any] ( )
231229 if style. foreground. alphaComponent != 0 {
232- attrs [ . foregroundColor] = style. foreground
230+ let color = style. foreground. isTextColor ? NSColor . textColor : style. foreground
231+ attrs [ . foregroundColor] = color
233232 }
234233
235234 //FIXME: background color is always set, plus is paints over cursors.
@@ -252,3 +251,10 @@ extension NSMutableAttributedString {
252251 self . addAttributes ( attrs, range: utf16Range)
253252 }
254253}
254+
255+ extension NSColor {
256+ var isTextColor : Bool {
257+ let themeTextGray : CGFloat = 0.19607843137254902
258+ return self . blueComponent == themeTextGray && self . greenComponent == themeTextGray && self . redComponent == themeTextGray
259+ }
260+ }
0 commit comments