[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: Match subtle light and dark border colours to those defined in Asset catalog
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Apr 27 13:24:32 UTC 2024
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
868c03c6 by Claudio Cambra at 2024-04-27T13:03:03+00:00
macosx: Match subtle light and dark border colours to those defined in Asset catalog
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7392dba9 by Claudio Cambra at 2024-04-27T13:03:03+00:00
macosx: Update outline for audio group header colour when system theme changes
CGColor cannot respond to theme changes
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2 changed files:
- modules/gui/macosx/extensions/NSColor+VLCAdditions.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupHeaderView.m
Changes:
=====================================
modules/gui/macosx/extensions/NSColor+VLCAdditions.m
=====================================
@@ -95,12 +95,12 @@
+ (NSColor *)VLCLightSubtleBorderColor
{
- return [NSColor colorWithCalibratedWhite:0 alpha:0.1];
+ return [NSColor colorWithCalibratedWhite:0.85 alpha:1.0];
}
+ (NSColor *)VLCDarkSubtleBorderColor
{
- return [NSColor colorWithCalibratedWhite:1 alpha:0.3];
+ return [NSColor colorWithCalibratedWhite:0.3 alpha:1.0];
}
+ (NSColor *)VLCSubtleBorderColor
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupHeaderView.m
=====================================
@@ -45,14 +45,43 @@ NSString * const VLCLibraryAudioGroupHeaderViewIdentifier = @"VLCLibraryAudioGro
{
if (@available(macOS 10.14, *)) {
_playButton.bezelColor = NSColor.VLCAccentColor;
+ [NSApplication.sharedApplication addObserver:self
+ forKeyPath:@"effectiveAppearance"
+ options:NSKeyValueObservingOptionNew
+ context:nil];
}
self.backgroundEffectView.wantsLayer = YES;
self.backgroundEffectView.layer.cornerRadius = VLCLibraryUIUnits.smallSpacing;
self.backgroundEffectView.layer.borderWidth = 1;
- self.backgroundEffectView.layer.borderColor = NSColor.VLCSubtleBorderColor.CGColor;
+ [self updateColoredAppearance:self.effectiveAppearance];
}
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary<NSKeyValueChangeKey,id> *)change
+ context:(void *)context
+{
+ if ([keyPath isEqualToString:@"effectiveAppearance"]) {
+ NSAppearance * const effectiveAppearance = change[NSKeyValueChangeNewKey];
+ [self updateColoredAppearance:effectiveAppearance];
+ }
+}
+
+- (void)updateColoredAppearance:(NSAppearance *)appearance
+{
+ NSParameterAssert(appearance);
+ BOOL isDark = NO;
+ if (@available(macOS 10.14, *)) {
+ isDark = [appearance.name isEqualToString:NSAppearanceNameDarkAqua] ||
+ [appearance.name isEqualToString:NSAppearanceNameVibrantDark];
+ }
+
+ self.backgroundEffectView.layer.borderColor = isDark ?
+ NSColor.VLCDarkSubtleBorderColor.CGColor : NSColor.VLCLightSubtleBorderColor.CGColor;
+}
+
+
- (void)updateRepresentation
{
const id<VLCMediaLibraryItemProtocol> actualItem = self.representedItem.item;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/44205b0c8400d5b7fba5cc0531a42fb12bae5a87...7392dba9c2d02271b434180ee656bb6e23c4c791
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/44205b0c8400d5b7fba5cc0531a42fb12bae5a87...7392dba9c2d02271b434180ee656bb6e23c4c791
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list