File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 1010
1111@interface SCSelectionView : NSView
1212
13+ @property (nonatomic , strong ) NSColor *selectionColor;
14+
1315@end
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments