Skip to content

Commit 0945fd6

Browse files
Use named colors for drag file view background
- Use named colors, guarded by availability check - Use new system effect for macOS 10.14 to generate highlight color - Fallback to original color values if named colors or system effects are unavailable
1 parent 18664b2 commit 0945fd6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

BuildSettingExtractor/DragFileView.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,17 @@ - (instancetype)initWithFrame:(NSRect)frameRect {
3535

3636
- (void)setHighlight:(BOOL)flag {
3737
if (flag) {
38-
self.fillColor = [NSColor colorWithCalibratedRed:0.56 green:0.7 blue:0.81 alpha:1.0];
38+
if (@available(macOS 10.14, *)) {
39+
self.fillColor = [[NSColor colorNamed: @"dragViewBackgroundColor"] colorWithSystemEffect:NSColorSystemEffectPressed];
40+
} else {
41+
self.fillColor = [NSColor colorWithCalibratedRed:0.56 green:0.7 blue:0.81 alpha:1.0];
42+
}
3943
} else {
40-
self.fillColor = [NSColor colorWithCalibratedRed:0.7 green:0.85 blue:1.0 alpha:1.0];
44+
if (@available(macOS 10.13, *)) {
45+
self.fillColor = [NSColor colorNamed: @"dragViewBackgroundColor"];
46+
} else {
47+
self.fillColor = [NSColor colorWithCalibratedRed:0.7 green:0.85 blue:1.0 alpha:1.0];
48+
}
4149
}
4250
}
4351

0 commit comments

Comments
 (0)