如何通过美化Windows Terminal,实现让命令行也养眼
- 2022-01-25
- 来源/作者: 菜鸟图库/ 菜鸟图库
- 811 次浏览
在Windows系统中玩命令行的小伙伴们,先是使用黑底白字的cmd命令提示符,后又用蓝底白字的Windows PowerShell,但这俩货没一个好看的(如图 1 )。难道玩代码命令行的注定就要与美绝缘吗?不对,代码如诗嘛!我们也要好看。现在我们可以用Windows Terminal,这款微软官方出品的Windows终端程序不但集成了PowerShell和cmd命令提示符,而且——好看(如图 2 )!不过,Windows Terminal并不是默认就这么好看,她也是需要你配置滴。下面就来教您怎样美化Windows Terminal,让命令行也养眼:


安装Windows Terminal
在Microsoft Store搜索Windows Terminal,即可找到她。如图:

或者,你也可以打开网页版Microsoft Store页面:
https://www.microsoft.com/store/productId/9N0DX20HK701
PS: 从应用介绍上你可以看到“主要功能包括多个选项卡……自定义主题、样式和配置”,所以说,我们是可以把Windows Terminal打扮好看的。
点击“获取”按钮即可自动安装Windows Terminal 。
启动Windows Terminal
启动Windows Terminal,默认打开的是Windows PowerShell命令行。如图:

你会发现,即使是默认样式,Windows Terminal中的Windows PowerShell也要比传统的更好看一些,例如圆角选项卡、圆润的字体等……
点击顶部选项卡最右侧的下拉箭头,在弹出的菜单中可以看到“命令提示符”。如图:

点击“命令提示符”即可以标签页的形式在同一窗口中打开cmd命令提示符窗口。如图:

好看先不说,这样把PowerShell和命令提示符集成在一起,是不是好用了许多?
美化Windows Terminal
既然微软欲用Fluent Design System彻底美化Windows10,那么这个新增的Windows Terminal肯定是跑不掉滴,只不过默认未启用Fluent Design风格而已。下面我们就来开启它,实现亚克力材质、高斯模糊半透明特效:
选择上面菜单中的“设置”,但这时并不会打开你相像中的设置窗口,而是询问你如何打开 setting.json 文件,选择用记事本打开。这是因为Windows Terminal的设置目前还是靠配置文件setting.json来实现的,尚未有图形化设置界面。
在 setting.json 配置文件中找到如下代码:
"defaults":
{
// Put settings here that you want to apply to all profiles.
},

在其中添加两行代码变成:
"defaults":
{
// Put settings here that you want to apply to all profiles.
"useAcrylic": true,
"acrylicOpacity": 0.4
},
解释一下添加的代码的释义如下:
- "useAcrylic": true 意为启用亚克力材质特效;
- "acrylicOpacity": 0.4 意为启用半透明效果。 0 为全透明, 1 为不透明,半透明度就是用小数取中间值。
保存修改后的文本文档。重新打开Windows Terminal,你就可以看到变得更好看的半透明的亚克力特效了。如图:

有童鞋可能会纳闷,我的咋没变透明呢?这个需要Windows10系统设置也开启透明效果才行。方法是:
打开Windows设置,依次进入“个性化 - 颜色”设置界面。如图:

把“透明效果”设置为“开”即可。