After downloading Windows Terminal, the initial screen is like this “silly big blue”.It’s not as beautiful as the official demo.
The first step is to install the relevant modules and PowerLine themes
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Copy the code
If you open PowerShell with administrator privileges and want to install Oh-my-posh to all users, enter
Install-Module posh-git
Install-Module oh-my-posh
Copy the code
After the installation is complete, enter
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
Copy the code
If the following error occurs
Unable to load file C:\Users\Hong\Documents\WindowsPowerShell\ microsoft.powershell _profile.ps1 because scripts are not allowed to run on this system. For more information, see about_Execution_Policies at http://go.micros oft.com/fwlink/?LinkID=135170. Position line :1 character: 3Copy the code
Run Windows Terminal again as an administrator and enter the following command. (If no error is reported, please ignore it.)
Set-ExecutionPolicy RemoteSigned
Copy the code
This time, however, the import-Module directives will have no effect when PowerShell is started again. This is because these directives are only valid for PowerShell in this session, so for this effect to be valid at each startup, you need to add them to the startup script. Open ~\Documents\WindowsPowerShell to create a new text document, name it Microsoft.powershell_profile.ps1 (remember to open the extension), type the following and save.
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerLine
Copy the code
This will load the custom file and enable the PowerLine theme every time PoweShell is opened.
It looks like garbled code. This is because there is no font to support ICONS.
Step 2 Register the font
I’m going to use the name Sarasa Term SC, which is the name that you’re going to use when you’re configuring Windows Terminal fonts (remember that) or else the little ICONS are going to be garbled. This font is an open source font, it can display Chinese beautifully, and it is equal width font, which means there will be no typographical errors in the terminal. You can download this font here.
After downloading, unpack and install
Of course, you can use the same width font as you like (preferably, but not mandatory).
Step 3 Modify the configuration file Windows on the terminal Terminal configuration file stored in ~ \ AppData \ Local \ Packages \ Microsoft WindowsTerminal_8wekyb3d8bbwe \ LocalState \ profiles. The json the json file, Open and edit in a Code editor (such as VS Code).
Next, add some configuration to beautify the interface. This is my configuration posted for reference
// 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}", // Windows Terminal opens the default program "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}", // Unique GUID do not change "name": "Windows PowerShell", "commandline": "Powershell. exe", "hidden": false, // Here are the newly added configuration items "closeOnExit" : true, "colorScheme" : "Ubuntu", // the name of the color theme is the name of each instance of schemes "cursorColor" : "# FFFFFF ", // the cursorColor" cursorShape" : "FilledBox ", // Cursor type Optional bar empytBox filledBox vintage "fontFace" : "Sarasa Term SC" 12, // Font size "historySize" : 8001, "icon" : "D:\\image\\phone.jpg", // the small icon of the program, that is, the icon address displayed in the title bar and new: "D:\\image\\bga.jpg", // configure the background image address "acrylicOpacity" : 0.75, // the larger the value, the stronger the background, otherwise the less "backgroundImageOpacity": // Background image transparency "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "%USERPROFILE%", "useAcrylic" : True, // Whether to enable the frosted glass effect, when the value is false, there is no frosted glass effect "tabTitle" : "ChessYu" // tag name}, {// Make changes here to the cmd.exe profile "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "cmd", "commandline": "cmd.exe", "hidden": false }, { "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Azure Cloud Shell", "source": "Windows.terminal.azure"}]}, // Add custom color schemes to this array "schemes": "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 any keybinding overrides to this array. // To unbind a default keybinding, Set the command to "unbound" "keybindings": []Copy the code
The fourth step is to choose a color theme
There are several Color Schemes built into the configuration file and they are all bright colors, which is not to my liking. We need to find our favorite Color Schemes at Mbadolato/Iterm2-color-schemes. There are more than 200 of them. You can download the format for Windows Terminal in the Windows Server folder in the repository. Once that is done paste it into the array of Schemes and set colorScheme in the configuration file you want to apply to the name of your new theme. Windows Terminal is updated in real time to see the final configuration effect.
conclusion
At that time, I had some trouble installing the fonts, always small ICONS were garbled, but later I found that the installation package of the fonts was not correct. It is best to follow the font installation steps above me, there is no problem.
Refer to the link