跳到主要内容

Napacitor CLI - nap assets

向 MAUI 宿主工程应用应用图标、启动屏与主题颜色。Napacitor 没有自己的图片处理流程:资源在 napacitor.config.json 中声明,实际的各平台位图由 MAUI Resizetizer 在构建时生成。

npx nap assets [maui]

行为:

  • 读取 napacitor.config.json 的 assets 段落。
  • 把 MauiIcon / MauiSplashScreen 属性(Color、ForegroundFile、BaseSize)写入宿主的 App.csproj。
  • 把颜色资源(来自 assets.colors)注入到 Resources/Styles/Colors.xaml。
  • 幂等:修改 icon.svg / splash.svg 或颜色后可安全重复执行。

示例配置:

{
"assets": {
"sourceDir": "assets",
"icon": "icon.svg",
"iconForeground": "icon-fg.svg",
"iconColor": "#1E88E5",
"splash": "splash.svg",
"splashColor": "#FFFFFF",
"splashBaseSize": "128,128",
"colors": {
"Primary": "#1E88E5"
}
}
}

完整流程请参阅启动屏与图标。