File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 2525#import " NSColor+ColorSetKit.h"
2626#import " ColorSet.h"
2727#import " ColorPair.h"
28+ #import < objc/runtime.h>
2829
2930static ColorSet * MainColorSet = nil ;
3031static NSLock * Lock = nil ;
@@ -34,18 +35,13 @@ @implementation NSColor( ColorSetKit )
3435+ ( nullable NSColor * )colorFromColorSet : ( NSString * )name
3536{
3637 static dispatch_once_t once;
37- static BOOL ( ^ isDark )( void );
3838
3939 dispatch_once
4040 (
4141 &once,
4242 ^( void )
4343 {
44- Lock = [ NSLock new ];
45- isDark = ^
46- {
47- return NO ;
48- };
44+ Lock = [ NSLock new ];
4945 }
5046 );
5147
@@ -63,13 +59,16 @@ + ( nullable NSColor * )colorFromColorSet: ( NSString * )name
6359
6460 pair = [ MainColorSet.colors objectForKey: name ];
6561
66- if ( pair != nil )
62+ if ( @ available ( macOS 10.14 , * ) )
6763 {
68- return ( pair.variant != nil && isDark () ) ? pair.variant : pair.color ;
64+ if ( pair.variant != nil && [ [ NSAppearance currentAppearance ].name isEqualToString: NSAppearanceNameDarkAqua ] )
65+ {
66+ return pair.variant ;
67+ }
6968 }
69+
70+ return pair.color ;
7071 }
71-
72- return nil ;
7372}
7473
7574@end
You can’t perform that action at this time.
0 commit comments