国庆节10月1日
--



目标:把 Windows Terminal 配成 「浅色毛玻璃 + Frost 白底配色 + 自定义背景图 + Powerline 提示符」。 全程照抄即可,不需要编程基础。每一步都标了「做什么」和「为什么」。
| 想要的效果 | 由什么控制 |
|---|---|
| 毛玻璃(半透明模糊) | Windows Terminal 的「亚克力 Acrylic」材质 + 不透明度 |
| 白底黑字配色 | 自定义配色方案 Frost |
| 终端里的背景图 | 配置文件的 backgroundImage(画在毛玻璃之上,用透明度叠加) |
| Powerline 提示符(带箭头/图标) | Oh My Posh |
| 提示符里的特殊图标 | Nerd Font 字体(CaskaydiaCove NF) |
系统:Windows 10(1809 及以上)或 Windows 11。
winget:在 PowerShell 里输入 winget -v,能出版本号就没问题。
背景图:准备一张图,记住完整路径,例如 C:\Users\你的用户名\Pictures\桌面壁纸\bj.jpg
winget install —id Microsoft.WindowsTerminal -e
想装预览版就把 ID 换成
Microsoft.WindowsTerminal.Preview。
装完开始菜单里会出现 Windows Terminal(WT)。
winget install —id JanDeDobbeleer.OhMyPosh -e
装完会出现 oh-my-posh 命令。
oh-my-posh font install CascadiaCode
看到类似下面的提示就成功了:
The following font families are now available for configuration:
• CaskaydiaCove NF
• CaskaydiaCove NFM
• CaskaydiaCove NFP
如果卡住/超时(GitHub 在国内容易连不上):见 附录 A 的镜像下载脚本。
Oh My Posh 是通过「PowerShell 配置文件」生效的。
在 PowerShell 里运行:
dir=Split−Path−ParentPROFILE
if (-not (Test-Path dir)) { New-Item -ItemType Directory -Force -Path dir | Out-Null }
Add-Content -Path $PROFILE -Value “n# Oh My Poshnoh-my-posh init pwsh | Invoke-Expression”
用记事本/VS Code 创建下面任意一个文件(两个都建最保险),内容只有一行:
oh-my-posh init pwsh | Invoke-Expression
| Shell | 配置文件路径 |
|---|---|
PowerShell 7(pwsh) | C:\Users\你的用户名\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 |
Windows PowerShell 5.1(powershell) | C:\Users\你的用户名\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
打开一个新的 PowerShell 窗口,提示符应该立刻变成 Powerline 样式。
Oh My Posh 默认主题就是 Powerline 风格。想看全部主题:
oh-my-posh themes
用某个主题时,把配置文件里那一行改成:
oh-my-posh init pwsh —config “$env
打开 Windows Terminal
按 Ctrl + , 打开设置
点左下角 「打开 JSON 文件」
文件默认路径:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json(预览版把Microsoft.WindowsTerminal换成Microsoft.WindowsTerminalPreview)
下面三段内容合并进你的 settings.json(不要把整个文件删掉重写,只加/改对应字段)。
在文件最外层(和 "profiles" 同级)加一行:
“theme”: “light”,
官方 Frost 主题就是浅色窗口。想跟随系统亮/暗色就用
"system"。
找到 "profiles" 里面的 "defaults": {},替换成:
“defaults”: { “backgroundImage”: “C:\Users\你的用户名\Pictures\桌面壁纸\bj.jpg”, “backgroundImageAlignment”: “center”, “backgroundImageOpacity”: 0.5, “backgroundImageStretchMode”: “uniformToFill”, “colorScheme”: “Frost”, “cursorColor”: “#000000”, “font”: { “face”: “CaskaydiaCove NF” }, “opacity”: 70, “useAcrylic”: true }
字段解释:
| 字段 | 含义 | 取值 |
|---|---|---|
backgroundImage | 背景图路径(\\ 是 JSON 转义,别写成 \) | 图片路径 / "desktopWallpaper" |
backgroundImageOpacity | 背景图自身透明度 | 0~1,越大越实 |
backgroundImageStretchMode | 填充方式 | none / fill / uniform / uniformToFill |
backgroundImageAlignment | 对齐方式 | center / left / top / right / bottom / topLeft … |
colorScheme | 配色方案名 | 必须是第 6.3 步里定义的名字 |
font.face | 字体名 | 必须和已安装字体一致(CaskaydiaCove NF) |
opacity | 窗口不透明度(毛玻璃强度) | 0~100,100 全不透明 |
useAcrylic | 是否开启毛玻璃 | true / false |
找到 "schemes": [],替换成下面内容(注意保留外层中括号):
“schemes”: [ { “name”: “Frost”, “background”: “#FFFFFF”, “foreground”: “#000000”, “cursorColor”: “#000000”, “black”: “#3C5712”, “blue”: “#17b2ff”, “cyan”: “#3C96A6”, “green”: “#6AAE08”, “purple”: “#991070”, “red”: “#8D0C0C”, “white”: “#6E386E”, “yellow”: “#991070”, “brightBlack”: “#749B36”, “brightBlue”: “#27B2F6”, “brightCyan”: “#13A8C0”, “brightGreen”: “#89AF50”, “brightPurple”: “#F2A20A”, “brightRed”: “#F49B36”, “brightWhite”: “#741274”, “brightYellow”: “#991070” } ]
如果你原来的
"schemes"里已经有别的方案,把上面这个对象追加进去(注意逗号)。
Ctrl + S 保存。WT 会自动热加载,不用重启也能看到大部分变化(字体/主题有时需要重启)。
把所有 Windows Terminal 窗口全部关掉,再重新打开,然后新建一个标签页。
应该看到:
浅色窗口
白色毛玻璃背景(隐约透出桌面)
背景图(半透明叠加)
Powerline 提示符
| 想要…… | 改哪里 |
|---|---|
| 背景图更明显 / 更淡 | backgroundImageOpacity(0~1) |
| 毛玻璃更透 / 更实 | opacity(0~100) |
| 背景图位置 | backgroundImageAlignment |
| 背景图填充方式 | backgroundImageStretchMode |
| 换提示符主题 | 改 PowerShell 配置文件里的 oh-my-posh init pwsh --config ... |
| 换字体 | font.face |
| 窗口跟随系统亮/暗色 | "theme": "system" |
没任何变化 → 把 WT 全部关掉再开;再不行重启电脑。
提示符没变成 Powerline → 新开一个 PowerShell 窗口;手动运行 oh-my-posh init pwsh | Invoke-Expression 看是否报错;确认配置文件路径正确。
提示符里的图标是方块/问号 → 字体没装成功,重跑第 4 步;或确认 font.face 写的是 CaskaydiaCove NF。
毛玻璃没生效 → 确认 useAcrylic 是 true,opacity 小于 100。
WT 提示配置有误 → 设置界面会红字提示哪一行,照着改;或把 JSON 贴到在线校验器检查。
背景图不显示 → 检查路径是否正确(注意 JSON 里用 \\);图片格式支持 png/jpg/gif。
WT 的背景图是画在毛玻璃之上的,所以它本身不会被毛玻璃模糊。如果你想要官方截图那种「图片透过毛玻璃模糊透出」的效果,需要把图片设为桌面壁纸:
Add-Type @’ using System; using System.Runtime.InteropServices; public class Wallpaper { [DllImport(“user32.dll”, CharSet = CharSet.Auto)] public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); } ’@ [Wallpaper]::SystemParametersInfo(20, 0, “C:\Users\你的用户名\Pictures\桌面壁纸\bj.jpg”, 3)
如果不想改桌面壁纸,又想换背景图,把 WT 的
backgroundImage指向"desktopWallpaper"也能直接跟随壁纸。
把下面内容保存为 install-font.ps1,右键「使用 PowerShell 运行」,或在该文件夹打开 PowerShell 执行 powershell -ExecutionPolicy Bypass -File .\install-font.ps1。
ErrorActionPreference=′Stop′version = ‘v3.5.1’ # nerd-fonts 版本,必要时去 GitHub 查看最新
archive=′CascadiaCode.tar.xz′mirrors = @(
‘https://ghfast.top/https://github.com/ryanoasis/nerd-fonts/releases/download/{0}/{1}’,
‘https://ghproxy.net/https://github.com/ryanoasis/nerd-fonts/releases/download/{0}/{1}’,
‘https://gh.llkk.cc/https://github.com/ryanoasis/nerd-fonts/releases/download/{0}/{1}’,
‘https://mirror.ghproxy.com/https://github.com/ryanoasis/nerd-fonts/releases/download/{0}/{1}’,
‘https://github.com/ryanoasis/nerd-fonts/releases/download/{0}/{1}’
)
out=Join−Pathenv
extract=Join−Pathenv
zip=Join−Pathenv
把下面内容存成 setup.ps1 运行,可自动完成第 2~5 步(背景图/配色仍需按第 6 步手动合并 JSON)。
winget install —id Microsoft.WindowsTerminal -e
winget install —id JanDeDobbeleer.OhMyPosh -e
oh-my-posh font install CascadiaCode
files=@(′C:\Users\你的用户名\Documents\PowerShell\Microsoft.PowerShellprofile.ps1′,′C:\Users\你的用户名\Documents\WindowsPowerShell\Microsoft.PowerShellprofile.ps1′)foreach(f in files) { dir = Split-Path -Parent fif(−not(Test−Pathdir)) { New-Item -ItemType Directory -Force -Path dir | Out-Null } if (-not (Test-Path f)) { Set-Content -Path $f -Value “oh-my-posh init pwsh | Invoke-Expression” -Encoding UTF8 } }
Write-Output ‘安装完成,接下来按第 6 步配置 settings.json’
| 项目 | 路径 |
|---|---|
| WT 配置文件 | %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json |
| WT 预览版配置 | %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState\settings.json |
| PS7 配置文件 | %USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 |
| PS5.1 配置文件 | %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 |
| 用户字体目录 | %LOCALAPPDATA%\Microsoft\Windows\Fonts |
| 用户字体注册表 | HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Fonts |
暂未播放



"人生最重要的两天,一是你来到世界的那天,二是你明白为什么来到这个世界的那天。"—— 马克·吐温


