vlc | branch: master | Felix Paul Kühne <[email protected]> | Sun Sep 23 23:49:59 2018 +0200| [856a0ce287eaed49f2404f01b7ea627367e5b83c] | committer: Felix Paul Kühne
macosx/VLCBottomBarView: add dark mode support for mojave > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=856a0ce287eaed49f2404f01b7ea627367e5b83c --- modules/gui/macosx/VLCBottomBarView.m | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/gui/macosx/VLCBottomBarView.m b/modules/gui/macosx/VLCBottomBarView.m index c9fab004f4..d52ac90e7f 100644 --- a/modules/gui/macosx/VLCBottomBarView.m +++ b/modules/gui/macosx/VLCBottomBarView.m @@ -1,10 +1,11 @@ /***************************************************************************** * VLCBottomBarView.m ***************************************************************************** - * Copyright (C) 2017 VLC authors and VideoLAN + * Copyright (C) 2017-2018 VLC authors and VideoLAN * $Id$ * * 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 * it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ *****************************************************************************/ #import "VLCBottomBarView.h" +#import "CompatibilityFixes.h" @interface VLCBottomBarView () { NSBezierPath *_rectanglePath; @@ -72,9 +74,19 @@ 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]; - _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 (OSX_MOJAVE_AND_HIGHER) { + _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.27 green:0.27 blue:0.27 alpha:1.0] + 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 @@ -130,4 +142,16 @@ 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 _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
