Skip to content

Commit

Permalink
Don't create new typingAttributes in -setTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Aug 25, 2014
1 parent a5b8ee4 commit cbb3b89
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Chromatism/Chromatism/JLTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ - (void)setSyntaxTokenizer:(JLTokenizer *)tokenizer

-(void)setTheme:(JLTokenizerTheme)theme
{
self.syntaxTokenizer.colors = [Chromatism colorsForTheme:theme];
self.typingAttributes = @{ NSForegroundColorAttributeName : self.syntaxTokenizer.colors[JLTokenTypeText]};
_theme = theme;

//Set font, text color and background color back to default
// Set font- and background color from the theme
self.syntaxTokenizer.colors = [Chromatism colorsForTheme:theme];
NSMutableDictionary *typingAttributes = self.typingAttributes.mutableCopy;
typingAttributes[NSForegroundColorAttributeName] = self.syntaxTokenizer.colors[JLTokenTypeText];
self.typingAttributes = typingAttributes;

UIColor *backgroundColor = self.syntaxTokenizer.colors[JLTokenTypeBackground];
[self setBackgroundColor:backgroundColor ? backgroundColor : [UIColor whiteColor] ];

Expand Down

0 comments on commit cbb3b89

Please sign in to comment.