贴个图

众所周知,Windows Terminal没有美化后那个傻大蓝,沉默黑简直不忍直视。没有像官方演示的那么美观(所以得自己捯饬捯饬好看的样子)
美化开始
第一步安装相关的模块和PowerLine主题
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
如果你使用管理员权限打开PowerShell并且想把oh-my-posh安装到所有用户,则输入
Install-Module posh-git
Install-Module oh-my-posh
安装完成后,输入
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
但是这次使用Import-Module的指令,再次启动PowerShell就会发现没有效果,这是因为这些指令仅限于本次会话的PowerShell有效,因此,若要使这一效果在每次启动的时候都有效,那就要将其添加到启动脚本中。打开~\Documents\WindowsPowerShell
新建文本文档,命名为Microsoft.PowerShell_profile.ps1
,输入以下内容,保存
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
这样,在每次PoweShell打开的时候都会加载自定义的文件并启用PowerLine主题。
第二步注册字体
这里使用的是更纱等距黑体,即Sarasa Term SC 这个名称配置windows Terminal 字体时要用到(记得有这回事)要不然小图标还是乱码。这款字体是开源字体,可以美观地显示中文,而且是等宽字体,也就说在终端中不会出现排版错误,
下载地址:
https://github.com/be5invis/Sarasa-Gothic/releases
下载完毕之后,直接解压,把里面的文件直接安装到C:\Windows\Fonts
这个路径之中
第三步改造终端的配置文件
Windows Terminal的配置文件储存在~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json
这个json文件中,在代码编辑器中打开并编辑(比如VS Code)。不过一般很难打开,要设置管理员各种权限,简单点的话,点击设置就可以了

接下来就新增一些配置进去来美化界面。我的配置贴出来参考(前面带有//的是注释的意思,可以删掉。另外,我仅仅更改的powershell的别的还没有改)
// This file was initially generated by Windows Terminal Preview 1.1.1812.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
//"colorScheme": "One Half Dark",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
//"hidden": false //这里必须注释掉,否则会和 "closeOnExit" : true, 冲突
"closeOnExit" : true,
"colorScheme" : "Ubuntu", //颜色主题名称,就是schemes下面的每个实例的 name 值
"cursorColor" : "#ffffff", //光标颜色
"cursorShape" : "filledBox", //光标类型 可选 bar empytBox filledBox vintage
"fontFace" : "Sarasa Term SC", //字体名称 安装字体时的字体名称
"fontSize" : 12, //字体大小
"historySize" : 8001,
"icon" : "D:\\1others\\pictures\\图标\\wonder logo .png", //程序的小图标,也就是在标题栏和新建中显示的图标地址
"backgroundImage": "D:\\1others\\pictures\\wallaper\\terminal.jpg", //配置背景图片地址
"acrylicOpacity" : 0.75, //不透明度,值越大,背景就越浓,否则就越淡
"backgroundImageOpacity": 0.25, //背景图片的透明度
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true, //是否开启毛玻璃特效,值为false的时候就没有毛玻璃特效
"tabTitle" : "wonder" //标签名称
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
},
//{
// "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
// "hidden": false,
// "name": "Azure Cloud Shell",
// "source": "Windows.Terminal.Azure"
//},
{
"guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
"hidden": false,
"name": "kali-linux",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{bca8e596-e7e9-591d-a845-194064478442}",
"hidden": false,
"name": "kali",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{fc92b12d-5e99-527f-af52-87b60adc0f71}",
"hidden": false,
"name": "centos7",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes":
//自定义的主题
[
{
"name" : "One Half Dark",
"background" : "#696969",
"black" : "#282C34",
"blue" : "#7B68EE",
"brightBlack" : "#5A6374",
"brightBlue" : "#729fcf",
"brightCyan" : "#56B6C2",
"brightGreen" : "#98C379",
"brightPurple" : "#C678DD",
"brightRed" : "#E06C75",
"brightWhite" : "#DCDFE4",
"brightYellow" : "#E5C07B",
"cyan" : "#56B6C2",
"foreground" : "#DCDFE4",
"green" : "#7FFF00",
"purple" : "#BA55D3",
"red" : "#E06C75",
"white" : "#DCDFE4",
"yellow" : "#FFD700",
},
{
"name": "Ubuntu",
"black": "#2e3436",
"red": "#cc0000",
"green": "#4e9a06",
"yellow": "#c4a000",
"blue": "#3465a4",
"purple": "#75507b",
"cyan": "#06989a",
"white": "#d3d7cf",
"brightBlack": "#555753",
"brightRed": "#ef2929",
"brightGreen": "#8ae234",
"brightYellow": "#fce94f",
"brightBlue": "#729fcf",
"brightPurple": "#ad7fa8",
"brightCyan": "#34e2e2",
"brightWhite": "#eeeeec",
"background": "#300a24",
"foreground": "#eeeeec"
},
{
"name": "AdventureTime",
"black": "#050404",
"red": "#bd0013",
"green": "#4ab118",
"yellow": "#e7741e",
"blue": "#0f4ac6",
"purple": "#665993",
"cyan": "#70a598",
"white": "#f8dcc0",
"brightBlack": "#4e7cbf",
"brightRed": "#fc5f5a",
"brightGreen": "#9eff6e",
"brightYellow": "#efc11a",
"brightBlue": "#1997c6",
"brightPurple": "#9b5953",
"brightCyan": "#c8faf4",
"brightWhite": "#f6f5fb",
"background": "#1f1d45",
"foreground": "#f8dcc0"
}
],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
设置颜色主题
颜色主题就是"schemes":字段里面的
可以到
https://github.com/mbadolato/iTerm2-Color-Schemes
这里面选择自己喜欢的,选择好之后,把里面的配置直接粘贴到"schemes":字段之中即可。