Browse Source

macosx/VLCBottomBarView: add dark mode support for mojave

pull/72/head
Felix Paul Kühne 8 years ago
parent
commit
856a0ce287
  1. 32
      modules/gui/macosx/VLCBottomBarView.m

32
modules/gui/macosx/VLCBottomBarView.m

@ -1,10 +1,11 @@
/***************************************************************************** /*****************************************************************************
* VLCBottomBarView.m * VLCBottomBarView.m
***************************************************************************** *****************************************************************************
* Copyright (C) 2017 VLC authors and VideoLAN * Copyright (C) 2017-2018 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Marvin Scholz <epirat07 at gmail dot com> * Authors: Marvin Scholz <epirat07 at gmail dot com>
* Felix Paul Kühne <fkuehne at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +23,7 @@
*****************************************************************************/ *****************************************************************************/
#import "VLCBottomBarView.h" #import "VLCBottomBarView.h"
#import "CompatibilityFixes.h"
@interface VLCBottomBarView () { @interface VLCBottomBarView () {
NSBezierPath *_rectanglePath; NSBezierPath *_rectanglePath;
@ -72,9 +74,19 @@
endingColor:[NSColor colorWithSRGBRed:0.82 green:0.82 blue:0.82 alpha:1.0]]; endingColor:[NSColor colorWithSRGBRed:0.82 green:0.82 blue:0.82 alpha:1.0]];
_lightStroke = [NSColor colorWithSRGBRed:0.65 green:0.65 blue:0.65 alpha:1.0]; _lightStroke = [NSColor colorWithSRGBRed:0.65 green:0.65 blue:0.65 alpha:1.0];
_darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.24 green:0.24 blue:0.24 alpha:1.0] if (OSX_MOJAVE_AND_HIGHER) {
endingColor:[NSColor colorWithSRGBRed:0.07 green:0.07 blue:0.07 alpha:1.0]]; _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.27 green:0.27 blue:0.27 alpha:1.0]
_darkStroke = [NSColor blackColor]; endingColor:[NSColor colorWithSRGBRed:0.22 green:0.22 blue:0.22 alpha:1.0]];
_darkStroke = [NSColor colorWithSRGBRed:0.17 green:0.17 blue:0.18 alpha:1.0];
} else {
_darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.24 green:0.24 blue:0.24 alpha:1.0]
endingColor:[NSColor colorWithSRGBRed:0.07 green:0.07 blue:0.07 alpha:1.0]];
_darkStroke = [NSColor blackColor];
}
if (@available(macOS 10.14, *)) {
[self viewDidChangeEffectiveAppearance];
}
} }
- (void)calculatePaths - (void)calculatePaths
@ -130,4 +142,16 @@
return NO; return NO;
} }
- (void)viewDidChangeEffectiveAppearance
{
if (@available(macOS 10_14, *)) {
if ([self.effectiveAppearance.name isEqualToString:NSAppearanceNameDarkAqua])
[self setDark:YES];
else
[self setDark:NO];
[self setNeedsDisplay:YES];
}
}
@end @end

Loading…
Cancel
Save