         
         tokenizer.tokenize(self.string) { (token, range, keywordRange) in
             layoutManager.addTemporaryAttribute(.token, value: token, forCharacterRange: range)
-            layoutManager.addTemporaryAttribute(.roundedBackgroundColor, value: backgroundColor, forCharacterRange: range)
-            layoutManager.addTemporaryAttribute(.foregroundColor, value: braketColor, forCharacterRange: range)
-            layoutManager.addTemporaryAttribute(.foregroundColor, value: textColor, forCharacterRange: keywordRange)
+            layoutManager.addTemporaryAttribute(.roundedBackgroundColor, value: NSColor.tokenBackgroundColor, forCharacterRange: range)
+            layoutManager.addTemporaryAttribute(.foregroundColor, value: NSColor.tokenBraketColor, forCharacterRange: range)
+            layoutManager.addTemporaryAttribute(.foregroundColor, value: NSColor.tokenTextColor, forCharacterRange: keywordRange)
         }
     }
     


final class TokenTextView: NSTextView {
    
    var tokenizer: Tokenizer?
    var tokenColor: NSColor = .selectedControlColor
    
    
    
    // MARK: -
    // MARK: Text View Methods
    
    override func viewDidMoveToWindow() {
        
        super.viewDidMoveToWindow()
        
        guard self.window != nil else { return }
        
        NotificationCenter.default.addObserver(self, selector: #selector(invalidateTokens), name: NSColor.systemColorsDidChangeNotification, object: nil)
    }
    
    
    override func viewDidChangeEffectiveAppearance() {
        
        super.viewDidChangeEffectiveAppearance()
        
        self.invalidateTokens()
    }
    
    
    override var string: String {
        

    }
    
}



private extension NSColor {
    
    static let tokenTextColor = NSColor(name: nil) { (appearance) in
        NSColor.selectedControlColor.blended(withFraction: 0.7, of: appearance.isDark ? .white : .black)!
    }
    
    static let tokenBraketColor = NSColor(name: nil) { (appearance) in
        NSColor.selectedControlColor.blended(withFraction: 0.3, of: appearance.isDark ? .white : .black)!
    }
    
    static let tokenBackgroundColor = NSColor(name: nil) { (appearance) in
        NSColor.selectedControlColor.withAlphaComponent(appearance.isDark ? 0.5 : 0.3)
    }
    
}
