美文网首页
macOS开发App避免深色模式

macOS开发App避免深色模式

作者: rekcah1986 | 来源:发表于2024-09-25 15:51 被阅读0次

使用Python做的工具,使用nuitka生成app以后,在深色模式下文本看不清,因为配色写死了……
懒得改,找资料发现可以通过修改Info.plist强行使用亮色模式

# 定义应用的 Info.plist 文件路径
# 使用 `defaults` 命令写入 NSRequiresAquaSystemAppearance 设置
# 以避免macOS黑暗模式下无法显示的问题
INFO_PLIST="dist/SpineExporter.app/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Add :NSRequiresAquaSystemAppearance bool true" "$INFO_PLIST" || {
    echo "Error: Failed to add NSRequiresAquaSystemAppearance key."
    exit 1
}

即:
    <key>NSRequiresAquaSystemAppearance</key>
    <true/>

就酱~

相关文章

网友评论

      本文标题:macOS开发App避免深色模式

      本文链接:https://www.haomeiwen.com/subject/ldvcrjtx.html