有没有办法根据系统 dark/light 模式更改 macOS 终端的 theme/profile?

Is there a way to change macOS Terminal's theme/profile based on the system dark/light mode?

在 macOS 的终端应用程序中,默认主题 (Basic) 会动态适应系统设置,但一旦我从首选项菜单中自定义 Basic 主题,它就会停止适应。有没有办法手动配置终端来查看系统模式并适当地选择主题?

终端没有动态选择主题的设置。但是,在自定义主题(或创建自己的主题)时,您可以选择动态适应 OS.

的颜色

在 macOS 的终端应用程序中选择颜色时,转到第三个选项卡,然后从顶部的下拉菜单中选择开发人员。这些颜色会自动适应当前的系统主题。

如果您的系统处于深色模式,对于那些最终来到这里寻找更改终端主题的方法的人,我确实找到了这个解决方案 dark-mode-macos-safari-iterm-vim,您可以默认使用浅色主题,这将覆盖在深色模式下启动终端时使用深色主题。

# Switch to Solarized Dark if we are currently in dark mode
if [[ "$(uname -s)" == "Darwin" ]]; then
  val=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
  if [[ $val == "Dark" ]]; then
    osascript -e 'tell application "Terminal"
      set current settings of tabs of windows to settings set "Solarized Dark" # Theme name
    end tell'
  else
  fi
fi