当前位置:首页 > 科技新闻 > Windows编程 > 正文

Windows Terminal 美化教程
2021-09-08 11:50:13

Windows Terminal 美化教程

1.安装Windows Terminal

在微软商店搜索Windows Terminal下载即可

2.安装相应的插件

使用管理员权限打开Windows Terminal并运行

Install-Module posh-git
Install-Module oh-my-posh

使用主题

Set-PoshPrompt -Theme blueish

许多教程里是

Set-Theme blueish

这是在oh-my-posh旧版的命令

3.安装字体

oh-my-posh中会使用一些特殊符号,使用主题时终端出现方框,因此采用推荐的Meslo字体,下载安装包后解压放置在C:/Windows/Fonts中即可完成安装。

4.配置主题

Set-PoshPrompt -Theme blueish

该命令只对当前终端有效,终端重新打开后会失效

code $PROFILE

该命令是编辑powershell配置文件命令

打开文件后编辑内容后保存:

Import-Module posh-git 
Import-Module oh-my-posh 
Set-PoshPrompt -Theme blueish

这样每次打开Windows Terminal都会将主题设置一次

5.自定义

配置Windows Terminal

打开JSON配置文件:

修改profiles-list该配置项为下拉框中每个选项的详细配置,给powershell添加以下配置:

"backgroundImage" : "D://Data//Files//图片//壁纸//row//wallhaven-9mogy1.jpg", // 背景图片地址
"backgroundImageOpacity" : 0.8,  //透明度
"backgroundImageStretchMode": "uniformToFill", // 图片伸缩模式:设置伸缩模式成按比例放大
"backgroundImageOpacity" : 0.2,  //透明度
"acrylicOpacity" : 0.5, //  定义亚克力效果的透明度
"useAcrylic": true, // 毛玻璃效果
"background" : "#242425",  // 背景颜色
"fontFace":"MesloLGM NF", // 字体
"fontSize": 10, // 字体大小
"padding": "5, 5, 20, 25",
"colorScheme": "Cobalt Neon" // 颜色方案

可以在default中添加部分设置,让每个终端界面都使用主题。

colorScheme对应的配色方案设置在schemes

{
                "name": "Cobalt Neon",
                "black": "#142631",
                "red": "#ff2320",
                "green": "#3ba5ff",
                "yellow": "#e9e75c",
                "blue": "#8ff586",
                "purple": "#781aa0",
                "cyan": "#8ff586",
                "white": "#ba46b2",
                "brightBlack": "#fff688",
                "brightRed": "#d4312e",
                "brightGreen": "#8ff586",
                "brightYellow": "#e9f06d",
                "brightBlue": "#3c7dd2",
                "brightPurple": "#8230a7",
                "brightCyan": "#6cbc67",
                "brightWhite": "#8ff586",
                "background": "#142838",
                "foreground": "#8ff586",
                "selectionBackground": "#094fb1",
                "cursorColor": "#c4206f"
}

最终效果:

本文摘自 :https://www.cnblogs.com/