記事のディレクトリ
ダークモードでI、
今年のWWDCは、MacOSの10.15を公開している、ごく最近暗いモードにもっと注意を適応し、システムの昨年のバージョンを持ってモハビ。利点は、次の抜粋は内容があり、最初のアドレスバーに貼り付けるまとめたので、我々は、記事を書かれているということです。
-
あなたのダークモードはサポートしています
https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interface?language=objc -
OS X / MacOSで「リアルダークモード」を有効にする方法
https://medium.com/@guilhermerambo/how-to-enable-real-dark-mode-on-os-x-macos-14966f9f7d24 -
マックのダークサイド:更新iPhoneアプリ
https://mackuba.eu/2018/07/10/dark-side-mac-2/
https://stackoverflow.com/questions/37359825/how-do-i-implement-night-mode-in-mac-cocoa-application
http://www.sohu.com/a/256885010_115785
- TomatosX:ダークグレーOS Xのメニューバー(ステータスバー)とドックかどうかを決定する
https://www.jianshu.com/p/91400658a63b
第二に、コマンドラインで有効/無効をダークモード
defaults write -g NSRequiresAquaSystemAppearance -bool No
ダークモードのアプリケーションを閉じます。
defaults write com.google.Chrome NSRequiresAquaSystemAppearance -bool YES //关闭深色模式
defaults write com.google.Chrome NSRequiresAquaSystemAppearance -bool NO //启用
defaults write -g NSWindowDarkChocolate -bool TRUE
defaults write -g NSWindowDarkChocolate -bool FALSE
第三に、パターン検出闇
1、コマンドライン defaults read -g AppleInterfaceStyle
ダークダークモード戻り値
$ defaults read -g AppleInterfaceStyle
Dark
非暗いパターン
$ defaults read -g AppleInterfaceStyle
2019-06-12 15:04:55.644 defaults[9672:767112]
The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist
図2に示すように、コード AppleInterfaceStyle
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle”];
NSLog(@"osxMode : %@",osxMode); //黑暗模式打印:Dark 非黑暗模式: (null)
第三に、アプリケーションは、暗いモードを使用していません
多くのアプリケーションでは、黒のモデルを使用する必要はありませんが、ブラックモードでは、窓枠は黒、または任意の他のフォントレンダリングの問題かもしれません。あなたは以下の設定が必要になります。
:Info.plistファイルへの鍵の追加
NSRequiresAquaSystemAppearance
ダークモードを使用せずに、[はい]に設定、すなわちを。
通知4ブラックモードの切り替え
ブラック、ユーザモードの切り替え、システムが通知されます。いくつかのジュニアパートナー・アプリケーションは、予告に応じて変更することができます。
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(darkModeChanged:) name:@"AppleInterfaceThemeChangedNotification" object:nil];
-(void)darkModeChanged:(NSNotification *)notif {
NSLog(@"Dark mode changed");
}
V.その他
1アンダーダークサイドバー、非明暗パターン
https://github.com/rensbreur/DarkSidebar/blob/master/screenshot.png