Use control background color for dark mode

This commit is contained in:
Lukhnos Liu 2018-11-20 21:28:46 -08:00
parent 8058f37fff
commit 14c2e70f7b
1 changed files with 3 additions and 3 deletions

View File

@ -131,13 +131,13 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; }
- (void)drawRect:(NSRect)dirtyRect - (void)drawRect:(NSRect)dirtyRect
{ {
NSColor *white = [NSColor whiteColor]; NSColor *backgroundColor = [NSColor controlBackgroundColor];
NSColor *darkGray = [NSColor colorWithDeviceWhite:0.7 alpha:1.0]; NSColor *darkGray = [NSColor colorWithDeviceWhite:0.7 alpha:1.0];
NSColor *lightGray = [NSColor colorWithDeviceWhite:0.8 alpha:1.0]; NSColor *lightGray = [NSColor colorWithDeviceWhite:0.8 alpha:1.0];
NSRect bounds = [self bounds]; NSRect bounds = [self bounds];
[white setFill]; [backgroundColor setFill];
[NSBezierPath fillRect:bounds]; [NSBezierPath fillRect:bounds];
[[NSColor darkGrayColor] setStroke]; [[NSColor darkGrayColor] setStroke];
@ -169,7 +169,7 @@ NS_INLINE CGFloat max(CGFloat a, CGFloat b) { return a > b ? a : b; }
[(NSMutableDictionary *)activeCandidateAttr setObject:[NSColor selectedTextColor] forKey:NSForegroundColorAttributeName]; [(NSMutableDictionary *)activeCandidateAttr setObject:[NSColor selectedTextColor] forKey:NSForegroundColorAttributeName];
} }
else { else {
[white setFill]; [backgroundColor setFill];
} }
[NSBezierPath fillRect:candidateRect]; [NSBezierPath fillRect:candidateRect];