Theme not settings
JosephShenton opened this issue · comments
For some reason the theme isn't setting. It's probably really easy but i can't figure it out
heres my code
let layoutManager = NSLayoutManager()
textStorage.addLayoutManager(layoutManager)
let textContainer = NSTextContainer(size: view.bounds.size)
layoutManager.addTextContainer(textContainer)
// highlightr = textStorage.highlightr
self.textStorage.highlightr.setTheme(to: "hopscotch")
textView = UITextView(frame: viewPlaceholder.bounds, textContainer: textContainer)
textView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
textView.autocorrectionType = UITextAutocorrectionType.no
textView.autocapitalizationType = UITextAutocapitalizationType.none
// textView.textColor = UIColor(white: 0.8, alpha: 1.0)
// textView.inputAccessoryView = textToolbar
viewPlaceholder.addSubview(textView)
let code = try! String.init(contentsOfFile: Bundle.main.path(forResource: "index", ofType: "html")!)
textView.text = code
Hey @JosephShenton, one quick question, where did you find about out highlightr? I am seeting a lot of traffic, but I have no idea were is coming from.
I found out by Googling "Swift Syntax highlighter github"
Well, that doesn't explain the rest of the people :S ... But, thank you.
@JosephShenton can you please share with us how you resolved this? I have the same problem.
I realised that the theme was indeed working, just that the background color of the UITextView
also needed to be set:
textView.backgroundColor = textStorage.highlightr.theme.themeBackgroundColor