37 lines
724 B
Plaintext
37 lines
724 B
Plaintext
#import "MacDarkMode.hpp"
|
|
|
|
#import <algorithm>
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <AppKit/NSScreen.h>
|
|
|
|
|
|
@implementation MacDarkMode
|
|
|
|
namespace Slic3r {
|
|
namespace GUI {
|
|
|
|
bool mac_dark_mode()
|
|
{
|
|
NSString *style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
|
|
return style && [style isEqualToString:@"Dark"];
|
|
|
|
}
|
|
|
|
double mac_max_scaling_factor()
|
|
{
|
|
double scaling = 1.;
|
|
if ([NSScreen screens] == nil) {
|
|
scaling = [[NSScreen mainScreen] backingScaleFactor];
|
|
} else {
|
|
for (int i = 0; i < [[NSScreen screens] count]; ++ i)
|
|
scaling = std::max<double>(scaling, [[[NSScreen screens] objectAtIndex:0] backingScaleFactor]);
|
|
}
|
|
return scaling;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
@end
|