Windows Terminal Inconsistent Color Scheme between Consoles

552 Views Asked by At

I am using Yori CMD and PowerShell Core in new Windows Terminal and I have a setup a custom color scheme as per the Windows Terminal documentations. But the colors are inconsistent between these two consoles.

For e.g. on PowerShell Core, folder name appears white and on Yori CMD, it appears purple.

Yori

enter image description here

PowerShell Core

enter image description here

My Config file for Windows Terminal

{
"$schema": "https://aka.ms/terminal-profiles-schema",

"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings

"disabledProfileSources": ["Windows.Terminal.Azure"],

// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,

// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,

// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
//   and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
    "defaults":
    {
        // Put settings here that you want to apply to all profiles.
        "startingDirectory": ".",
        "fontFace":  "Cascadia Code PL",
        "fontSize":  14,
        "colorScheme":  "DraculaPlusCustom",
        "backgroundImage": "F:\\Configurations\\wt_bg.jpg",
        "backgroundImageOpacity": 0.05,
        "backgroundImageStretchMode": "uniformToFill",
        "acrylicOpacity": 0.95,
        "useAcrylic": true,
        "cursorShape": "vintage",
        "cursorHeight": 25
        
    },
    "list":
    [
        {
            // Make changes here to the powershell.exe profile.
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false
        },
        {
            // Make changes here to the cmd.exe profile.
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "Command Prompt",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid":  "{7d04ce37-c00f-43ac-ba47-992cb1393215}",
            "name":  "Yori",
            "tabTitle":  "cmd",
            "commandline":  "C:\\Program Files\\Yori\\yori.exe",
            "icon":  "F:\\Software Projects\\Configurations\\yori.ico"
        },
        {
            "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
            "hidden": false,
            "name": "Ubuntu-20.04",
            "tabTitle":  "Ubuntu 20.04",
            "source": "Windows.Terminal.Wsl"
        },
        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore"
        }
    ]
},

// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
    {
        "name": "DraculaPlusCustom",

        "background": "#212121",
        "foreground": "#e6e6e6",

        "black": "#21222C",
        "red": "#FF5555",
        "green": "#50FA7B",
        "yellow": "#ffcb6b",
        "blue": "#82aaff",
        "purple": "#c792ea",
        "cyan": "#8BE9FD",
        "white": "#F8F8F2",
        "brightBlack": "#6b6b6b",
        "brightRed": "#FF6E6E",
        "brightGreen": "#69FF94",
        "brightYellow": "#ffcb6b",
        "brightBlue": "#D6ACFF",
        "brightPurple": "#FF92DF",
        "brightCyan": "#A4FFFF",
        "brightWhite": "#F8F8F2"
    }
],

// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
    // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
    // These two lines additionally bind them to Ctrl+C and Ctrl+V.
    // To learn more about selection, visit https://aka.ms/terminal-selection
    { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
    { "command": "paste", "keys": "ctrl+v" },

    // Press Ctrl+Shift+F to open the search box
    { "command": "find", "keys": "ctrl+shift+f" },

    // Press Alt+Shift+D to open a new pane.
    // - "split": "auto" makes this pane open in the direction that provides the most surface area.
    // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
    // To learn more about panes, visit https://aka.ms/terminal-panes
    { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]

}

How do I make it consistent color scheme between different consoles on Windows Terminal?

2

There are 2 best solutions below

0
On

Each shell configures their own prompt in their own way.

These shells can be configured to use any of the 16 colors of the color table. Notably, PSReadline (a part of PowerShell) will colorize the prompt line as you type, changing the colors of elements of the prompt. (You can read more about how PSReadline decides to colorize the prompt here)

Changing the scheme in the Terminal changes what values the color table has, but it won't change how the prompt is configured.

You can have your shell say "I'd like my prompt to be magenta", or "I'd like it to be red", without the chell having to know what red means.

0
On

Not an expert on Yori or Windows Terminal but you can set the color of the prompt in Yori like so:

In your YoriInit.d folder create a file yoriinit.ys1 like so ($E$[37;1m = white)

set YORIPROMPT=$E$[37;1m$P$$G_OR_ADMIN_G$

Color escapes here http://www.malsmith.net/yori/guide/#color_escapes, and info about yoriprompt here http://www.malsmith.net/yori/guide/#env_yoriprompt