Skip to content

Commit

Permalink
Theme preference support on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed Mar 31, 2020
1 parent 776b8ff commit 2898b63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions macos/src/main/objectiveCpp/ThemeInfo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@
JNIEXPORT jboolean JNICALL
Java_com_github_weisj_darklaf_platform_macos_JNIThemeInfoMacOS_isDarkThemeEnabled(JNIEnv *env, jclass obj) {
if(@available(macOS 10.14, *)) {
return (jboolean)false;
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
return (jboolean)[@"Dark" caseInsensitiveCompare:osxMode] == NSOrderedSame;
} else {
return (jboolean)false;
}
}

JNIEXPORT jboolean JNICALL
Java_com_github_weisj_darklaf_platform_macos_JNIThemeInfoMacOS_isHighContrastEnabled(JNIEnv *env, jclass obj) {
return NSWorkspace.shared.accessibilityDisplayShouldIncreaseContrast;
return NSWorkspace.sharedWorkspace.accessibilityDisplayShouldIncreaseContrast;
}

JNIEXPORT jlong JNICALL
Expand Down

0 comments on commit 2898b63

Please sign in to comment.