99#import " SCMiniMapView.h"
1010#import " SCXcodeMinimap.h"
1111
12+ static NSString * const DVTFontAndColorSourceTextSettingsChangedNotification = @" DVTFontAndColorSourceTextSettingsChangedNotification" ;
13+
1214@implementation SCMiniMapView
1315
1416- (id )initWithFrame : (NSRect )frame
@@ -33,6 +35,11 @@ - (id)initWithFrame:(NSRect)frame
3335 selector: @selector (hide )
3436 name: SCXodeMinimapWantsToBeHiddenNotification
3537 object: nil ];
38+
39+ [[NSNotificationCenter defaultCenter ] addObserver: self
40+ selector: @selector (updateTheme )
41+ name: DVTFontAndColorSourceTextSettingsChangedNotification
42+ object: nil ];
3643 }
3744 return self;
3845}
@@ -75,18 +82,7 @@ - (NSTextView *)textView
7582
7683 [self setDocumentView: _textView];
7784
78- NSColor *miniMapBackgroundColor = [NSColor clearColor ];
79- Class DVTFontAndColorThemeClass = NSClassFromString (@" DVTFontAndColorTheme" );
80-
81- if ([DVTFontAndColorThemeClass respondsToSelector: @selector (currentTheme )]) {
82-
83- NSObject *theme = [DVTFontAndColorThemeClass performSelector: @selector (currentTheme )];
84- if ([theme respondsToSelector: @selector (sourceTextBackgroundColor )]) {
85- miniMapBackgroundColor = [theme performSelector: @selector (sourceTextBackgroundColor )];
86- }
87- }
88-
89- [_textView setBackgroundColor: [miniMapBackgroundColor shadowWithLevel: kDefaultShadowLevel ]];
85+ [self updateTheme ];
9086 }
9187
9288 return _textView;
@@ -129,6 +125,23 @@ - (void)hide
129125
130126#pragma mark - Updating
131127
128+ - (void )updateTheme
129+ {
130+ NSColor *miniMapBackgroundColor = [NSColor clearColor ];
131+ Class DVTFontAndColorThemeClass = NSClassFromString (@" DVTFontAndColorTheme" );
132+
133+ if ([DVTFontAndColorThemeClass respondsToSelector: @selector (currentTheme )]) {
134+
135+ NSObject *theme = [DVTFontAndColorThemeClass performSelector: @selector (currentTheme )];
136+ if ([theme respondsToSelector: @selector (sourceTextBackgroundColor )]) {
137+ miniMapBackgroundColor = [theme performSelector: @selector (sourceTextBackgroundColor )];
138+ }
139+ }
140+
141+ [self .textView setBackgroundColor: [miniMapBackgroundColor shadowWithLevel: kDefaultShadowLevel ]];
142+ [self .selectionView setNeedsDisplay: YES ];
143+ }
144+
132145- (void )updateTextView
133146{
134147 if ([self isHidden ]) {
0 commit comments