Skip to content

Commit 28029b1

Browse files
committed
Changed SCSelectionView so that the fill color is now the inverse of the brightnessComponent of selected theme's backgroundColor
1 parent 643f924 commit 28029b1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

SCXcodeMinimap/SCSelectionView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010

1111
@interface SCSelectionView : NSView
1212

13+
@property (nonatomic, strong) NSColor *selectionColor;
14+
1315
@end

SCXcodeMinimap/SCSelectionView.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,24 @@
1010

1111
@implementation SCSelectionView
1212

13+
- (id)initWithFrame:(NSRect)frame
14+
{
15+
self = [super initWithFrame:frame];
16+
if (self) {
17+
18+
NSObject *DVTFontAndColorTheme = [NSClassFromString(@"DVTFontAndColorTheme") performSelector:@selector(currentTheme)];
19+
NSColor *backgroundColor = [DVTFontAndColorTheme performSelector:@selector(sourceTextBackgroundColor)];
20+
21+
// sets the selectionColor to the inverse of the brightnessComponent of the currently selected theme's backgroundColor
22+
[self setSelectionColor:[NSColor colorWithCalibratedHue:0.0f saturation:0.0f brightness:(1.0f - [backgroundColor brightnessComponent]) alpha:0.25f]];
23+
24+
}
25+
return self;
26+
}
27+
1328
- (void)drawRect:(NSRect)dirtyRect
1429
{
15-
[[NSColor colorWithDeviceRed:0.0f green:0.0f blue:0.0f alpha:0.3f] setFill];
30+
[[self selectionColor] setFill];
1631
NSRectFill(dirtyRect);
1732
}
1833

0 commit comments

Comments
 (0)