You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS:如何通过Shell命令正确设置半透明系统自定义高亮色

Mac系统高亮色Shell设置透明度不生效问题解决

我用Shell命令设置了自定义系统高亮色:

defaults write -g AppleHighlightColor -string "0.400000 0.400000 0.700000 1.000000"

但发现通过Shell命令设置的颜色是不透明的,而通过系统设置菜单设置的同一种颜色却有合适的半透明效果。

尝试降低alpha值调整透明度后再设置,依然没有预期效果:

defaults write -g AppleHighlightColor -string "0.400000 0.400000 0.700000 0.500000"

查看两种设置方式的defaults读取结果,发现明显差异:

  • Shell命令设置后:0.400000 0.400000 0.700000 1.000000
  • 系统设置后:0.400000 0.400000 0.700000 Other

解决方法

Mac系统的AppleHighlightColor参数中,当最后一位是Other时,会启用系统默认的半透明高亮效果,而非你指定的alpha值。要实现和系统设置一致的半透明效果,只需把命令中的alpha值替换成Other:

defaults write -g AppleHighlightColor -string "0.400000 0.400000 0.700000 Other"

执行完命令后,注销并重新登录系统,新的高亮色就会带有正确的半透明效果。

内容的提问来源于stack exchange,提问作者ldt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 17:47:01