     }
     
 }
+
+
+
+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)
+    }
+    
+}

        
        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)
        }
    }
    


final class TokenTextView: NSTextView {
    
    // MARK: Public Properties
    
    var tokenizer: Tokenizer?
    
    
    
    // MARK: -
    // MARK: Text View Methods
    
    override var string: String {
        
