Windows 終端機中的色彩配置Color schemes in Windows Terminal

Windows 終端機可讓您定義自己的色彩配置,方法是使用內建的預設配置,或是從頭開始建立自己的配置。Windows Terminal lets you define your own color schemes, either by using the built-in preset schemes, or by creating your own scheme from scratch. 若要變更配置,您必須在編輯器中編輯檔案的 settings.js,例如 Visual Studio CodeTo change schemes, you'll need to edit the settings.json file in an editor such as Visual Studio Code.

切換至不同的色彩配置Switching to a different color scheme

啟動 Windows 終端機然後選取標題列中的小型向下箭號。Launch Windows Terminal and then select the small downward-facing arrow in the title bar. 這會開啟下拉式功能表,列出您系統上可用的設定檔 (例如,Windows PowerShell 和命令提示字元) 以及其他一些選項。This will open a pull-down menu that lists the available profiles on your system (for example, Windows PowerShell and Command Prompt) and some other options. 選取 [ 設定],系統就會在您的預設文字編輯器中開啟檔案 settings.js。Select Settings, and the settings.json file will open in your default text editor.

您可以在此檔案中定義每個視窗或每個設定檔的各種選項。This file is where you can define various options per window or per profile. 為了示範,讓我們變更命令提示字元設定檔的色彩配置。To demonstrate, let's change the color scheme for the Command Prompt profile.

向下查看 JSON 檔案,直到找到包含下列內容的區段:Look down the JSON file until you find the section that includes:

"commandline": "cmd.exe",
"hidden": false

將它變更為 [讀取]:Change it to read:

"commandline": "cmd.exe",
"hidden": false,
"colorScheme": "Tango Light"

請注意 隱藏 行中的額外逗號。Notice the extra comma in the hidden line. 一旦您儲存此檔案,Windows 終端機將會更新任何開啟的視窗。Once you save this file, Windows Terminal will update any open window. 開啟 [命令提示字元] 索引標籤(如果您還沒有這麼做),您會立即看到色彩已變更。Open a Command Prompt tab if you haven't already, and you'll immediately see that the colors have changed.

建立您自己的色彩配置Creating your own color scheme

「Tango Light」配置包含作為預設選項,但是您可以從頭開始建立自己的配置,或複製現有的配置。The "Tango Light" scheme is included as a default option, but you can create your own scheme from scratch or by copying an existing scheme.

您可以在 settings.json 檔案的 schemes 陣列中定義色彩配置。Color schemes can be defined in the schemes array of your settings.json file. 色彩配置會使用下列格式寫入:They are written in the following format:

{
    "name" : "Campbell",

    "cursorColor": "#FFFFFF",
    "selectionBackground": "#FFFFFF",

    "background" : "#0C0C0C",
    "foreground" : "#CCCCCC",

    "black" : "#0C0C0C",
    "blue" : "#0037DA",
    "cyan" : "#3A96DD",
    "green" : "#13A10E",
    "purple" : "#881798",
    "red" : "#C50F1F",
    "white" : "#CCCCCC",
    "yellow" : "#C19C00",
    "brightBlack" : "#767676",
    "brightBlue" : "#3B78FF",
    "brightCyan" : "#61D6D6",
    "brightGreen" : "#16C60C",
    "brightPurple" : "#B4009E",
    "brightRed" : "#E74856",
    "brightWhite" : "#F2F2F2",
    "brightYellow" : "#F9F1A5"
},

除了 name 以外的每個設定,都接受十六進位格式字串形式的色彩:"#rgb""#rrggbb"Every setting, aside from name, accepts a color as a string in hex format: "#rgb" or "#rrggbb". cursorColorselectionBackground 設定是選擇性的。The cursorColor and selectionBackground settings are optional.



包含的色彩配置Included color schemes

Windows 終端機在 defaults.json 檔案內包含這些色彩配置,只要按住 alt 鍵並選取 [設定] 按鈕,即可存取配置。Windows Terminal includes these color schemes inside the defaults.json file, which can be accessed by holding alt and selecting the settings button.

CampbellCampbell

Windows 終端機 Campbell 色彩配置

Campbell PowershellCampbell Powershell

Windows 終端機 Campbell Powershell 色彩配置

老式Vintage

Windows 終端機老式色彩配置

半深色One Half Dark

Windows 終端機半深色色彩配置

半淺色One Half Light

Windows 終端機半淺色色彩配置

Tango 深色Tango Dark

Windows 終端機 Tango 深色色彩配置

Tango 淺色Tango Light

Windows 終端機 Tango 淺色色彩配置

其他架構More schemes

如需更多配置,請參閱 自訂終端 機資源庫一節。For more schemes, see the Custom Terminal Gallery section.