1. 程式人生 > 實用技巧 >Get 如何打造一款屬於自己的WindowsTerminal

Get 如何打造一款屬於自己的WindowsTerminal

前一陣很熱的一款軟體 Terminal,也算是微軟對醜了這麼久的命令視窗的一個交代,Terminal優化了程式碼顯示和自定義功能,可以在一個視窗下,可以自定義背景、文字大小、文字顏色等諸多功能,今天我來分享下自定義的細節部分,讓你快速的上手屬於自己的Terminal命令列!

先展示下我設計好的預覽圖,我比較喜歡的一個背景

我們開啟Windows自帶的軟體商店,搜尋Windows Terminal,點選安裝,把這個軟體安裝到自己的電腦上

安裝好之後是這樣的

初次安裝好之後,應該是黑底白字的,這時候樣式需要我們自己來配置,我們在下拉箭頭裡找到設定,點選設定會彈出配置檔案,這就是我們自定義terminal的地方了



// 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",
 
       //第一個位置就是預設開啟的視窗的位置,也就是你啟動這個Terminal的時候,開啟的哪個命令列,我這裡設定的是cmd為啟動顯示的視窗
       "defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
    "profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles
        },
        "list":
        [
          {
                // Make changes here to the cmd.exe profile
             //在這裡設定cmd視窗的樹形
            "acrylicOpacity" : 0.75,
             //背景圖片這個根據自己的需要進行設定,圖片可以設定為GIF動態圖,很有感覺
            "backgroundImage" : "D://fastSoftware//photo//girl.jpg",  
             //背景影象透明度
            "backgroundImageOpacity" : 0.95,
            "closeOnExit" : true, 
            "commandline" : "cmd.exe",
            "cursorColor" : "#C50F1F",
            "cursorShape" : "bar", 
            //顯示字型大小
            "fontSize" : 11,  
	    "colorScheme" : "CMD", 
            "guid" : "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",  
            "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            //在下拉選單裡顯示的名稱
            "name" : "cmd",
            //上下左右內邊距
            "padding" : "2,2,2,2",
            "snapOnInput" : true, 
            //標題顯示名稱
            "tabTitle" : "cmd",
            "useAcrylic" : false 
            },
            {
                //這是我安裝的Windows下的linux字系統,我只是簡單的配置了一個背景
                "guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
                "hidden": false,
                "name": "linux",
                "backgroundImage" : "D://fastSoftware//photo//girl.jpg",  
                "source": "Windows.Terminal.Wsl"
            },
            {
                // Make changes here to the powershell.exe profile
                //這是Windows自帶的powershell,同樣我也知識簡單的配置了一下背景,因為用到的次數少
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                "cursorColor" : "#C50F1F",
                "backgroundImage" : "D://fastSoftware//photo//girl.jpg"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },

    // Add custom color schemes to this array
    "schemes": [
{
            "background" : "#000000",   
            "black" : "#0C0C0C",
            "blue" : "#0037DA",
            "brightBlack" : "#767676",
            "brightBlue" : "#3B78FF",
            "brightCyan" : "#61D6D6",
            "brightGreen" : "#16C60C",
            "brightPurple" : "#B4009E",
            "brightRed" : "#E74856",
            "brightWhite" : "#F2F2F2",
            "brightYellow" : "#F9F1A5",
            "cyan" : "#DE813B",
            "foreground" : "#FFFFFF",   
            "green" : "#13A10E",
            "name" : "CMD",            
            "purple" : "#881798",
            "red" : "#C50F1F",
            "white" : "#CCCCCC",
            "yellow" : "#C19C00"
        }
        ],

    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    "keybindings": []
}


官方的配置文件詳見下面連線,經常使用命令列的小夥伴可要記得嘗試喲,更多玩法可以留言探索

https://docs.microsoft.com/zh-cn/windows/terminal/customize-settings/global-settings