Default color instead of white as foreground #17760

Closed
opened 2026-01-31 05:52:33 +00:00 by claunia · 18 comments
Owner

Originally created by @ADIX7 on GitHub (Jun 20, 2022).

Windows Terminal version

1.14.1451.0

Windows build number

10.0.19043.0

Other Software

No response

Steps to reproduce

With this tool you can render the color palett

Console.WriteLine("Hello, World!");
for (var i = 0; i < 8; i++)
{
    Console.ForegroundColor = (ConsoleColor)i;
    Console.Write("Hello, World!");
    Console.ForegroundColor = (ConsoleColor)(i + 8);
    Console.WriteLine("\tHello, World!");
}

Console.WriteLine();

for (var i = 0; i < 8; i++)
{
    Console.ForegroundColor = (ConsoleColor)ShiftColor(i);
    Console.BackgroundColor = (ConsoleColor)i;
    Console.Write("Hello, World!");

    Console.ResetColor();
    Console.Write("\t");

    Console.ForegroundColor = (ConsoleColor)ShiftColor(i + 8);
    Console.BackgroundColor = (ConsoleColor)(i + 8);
    Console.Write("Hello, World!");
    Console.ResetColor();
    Console.WriteLine();
}

static int ShiftColor(int c)
{
    var result = c + 8;
    while (result > 15) result = c -= 8;
    while (result < 0) result = c += 8;

    return result;
}

Expected Behavior

When using white as foreground color, white ("white" attribute in scheme config) should be used instead of the "default" foreground ("foreground" attribute in scheme config)

Actual Behavior

Currently the default foreground color is used even when the foreground color is set to white.

After running in the attached snippet it is obvious that the white foreground (1st block 1st column last row) and the white background (2nd block 1st column last row) are not the same, on the other hand the first "Hello World" has the same colors as the one with white foreground (1st block 1st column last row)

kép

Originally created by @ADIX7 on GitHub (Jun 20, 2022). ### Windows Terminal version 1.14.1451.0 ### Windows build number 10.0.19043.0 ### Other Software _No response_ ### Steps to reproduce With this tool you can render the color palett ```csharp Console.WriteLine("Hello, World!"); for (var i = 0; i < 8; i++) { Console.ForegroundColor = (ConsoleColor)i; Console.Write("Hello, World!"); Console.ForegroundColor = (ConsoleColor)(i + 8); Console.WriteLine("\tHello, World!"); } Console.WriteLine(); for (var i = 0; i < 8; i++) { Console.ForegroundColor = (ConsoleColor)ShiftColor(i); Console.BackgroundColor = (ConsoleColor)i; Console.Write("Hello, World!"); Console.ResetColor(); Console.Write("\t"); Console.ForegroundColor = (ConsoleColor)ShiftColor(i + 8); Console.BackgroundColor = (ConsoleColor)(i + 8); Console.Write("Hello, World!"); Console.ResetColor(); Console.WriteLine(); } static int ShiftColor(int c) { var result = c + 8; while (result > 15) result = c -= 8; while (result < 0) result = c += 8; return result; } ``` ### Expected Behavior When using white as foreground color, white ("white" attribute in scheme config) should be used instead of the "default" foreground ("foreground" attribute in scheme config) ### Actual Behavior Currently the default foreground color is used even when the foreground color is set to white. After running in the attached snippet it is obvious that the white foreground (1st block 1st column last row) and the white background (2nd block 1st column last row) are not the same, on the other hand the first "Hello World" has the same colors as the one with white foreground (1st block 1st column last row) ![kép](https://user-images.githubusercontent.com/10939090/174675411-2e7a254d-c7bf-4c03-8234-76dad18953da.png)
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 05:52:33 +00:00
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

Actually, based on this image it looks like the black background is also not correct as it uses the default background color.

@ADIX7 commented on GitHub (Jun 20, 2022): Actually, based on this image it looks like the black background is also not correct as it uses the default background color.
Author
Owner

@zadjii-msft commented on GitHub (Jun 20, 2022):

This seems like it's just a disconnect between the legacy Console colors, which only had 16 values (and the foreground & background were each one of those 16), vs the model the Terminal uses. The Terminal uses a 16-color palette, and then the FG & BG are separate colors in addition to the color table.

You know what, looking closer, I'm betting this is the automatic lightness adjustment. Could you share your settings.json file/?

@zadjii-msft commented on GitHub (Jun 20, 2022): ~This seems like it's just a disconnect between the legacy Console colors, which only had 16 values (and the foreground & background were each one of those 16), vs the model the Terminal uses. The Terminal uses a 16-color palette, and then the FG & BG are separate colors in addition to the color table.~ You know what, looking closer, I'm betting this is the automatic lightness adjustment. Could you share your [settings.json file](https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#where-can-i-find-the-settings-file)/?
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

MyTheme is the color scheme.

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "splitPane",
                "split": "right"
            },
            "keys": "ctrl+alt+2"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "down"
            },
            "keys": "ctrl+alt+5"
        }
    ],
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "profiles": 
    {
        "defaults": 
        {
            "colorScheme": "ADIX",
            "font": 
            {
                "face": "CaskaydiaCove NF"
            },
            "opacity": 80,
            "useAcrylic": true
        },
        "list": 
        [
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "cmd"
            },
            {
                "commandline": "gsudo \"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"",
                "guid": "{c3d1834f-b861-54a3-89fb-1c13f2363d95}",
                "hidden": false,
                "icon": "ms-appx:///ProfileIcons/{574e775e-4f2a-5b96-ac1e-a2962a402336}.png",
                "name": "PowerShell (admin)",
                "startingDirectory": "%USERPROFILE%"
            },
            {
                "commandline": "gsudo %SystemRoot%\\System32\\cmd.exe",
                "guid": "{0ad3d447-8f3d-513c-99e1-447b1dcda84a}",
                "hidden": false,
                "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name": "Command Prompt (admin)",
                "startingDirectory": "%USERPROFILE%"
            },
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{a3a2e83a-884a-5379-baa8-16f193a13b21}",
                "hidden": false,
                "name": "PowerShell 7 Preview",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{dc505395-c460-59d1-93a6-434a5808d193}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{d050a9e6-e1c2-5609-9f92-4c711743606d}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2022",
                "source": "Windows.Terminal.VisualStudio"
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#002B36",
            "black": "#171421",
            "blue": "#2A7BDE",
            "brightBlack": "#5E5C64",
            "brightBlue": "#308DFF",
            "brightCyan": "#33C7DE",
            "brightGreen": "#33D17A",
            "brightPurple": "#C061CB",
            "brightRed": "#F66151",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFD00",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA1B3",
            "foreground": "#839496",
            "green": "#26A269",
            "name": "MyTheme",
            "purple": "#A347BA",
            "red": "#C01C28",
            "selectionBackground": "#FFFFFF",
            "white": "#D0CFCC",
            "yellow": "#CECB00"
        },
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#4F6066",
            "blue": "#268BD2",
            "brightBlack": "#47565C",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ]
}
@ADIX7 commented on GitHub (Jun 20, 2022): MyTheme is the color scheme. ```json { "$help": "https://aka.ms/terminal-documentation", "$schema": "https://aka.ms/terminal-profiles-schema", "actions": [ { "command": { "action": "splitPane", "split": "right" }, "keys": "ctrl+alt+2" }, { "command": { "action": "splitPane", "split": "down" }, "keys": "ctrl+alt+5" } ], "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "profiles": { "defaults": { "colorScheme": "ADIX", "font": { "face": "CaskaydiaCove NF" }, "opacity": 80, "useAcrylic": true }, "list": [ { "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore" }, { "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "hidden": false, "name": "cmd" }, { "commandline": "gsudo \"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"", "guid": "{c3d1834f-b861-54a3-89fb-1c13f2363d95}", "hidden": false, "icon": "ms-appx:///ProfileIcons/{574e775e-4f2a-5b96-ac1e-a2962a402336}.png", "name": "PowerShell (admin)", "startingDirectory": "%USERPROFILE%" }, { "commandline": "gsudo %SystemRoot%\\System32\\cmd.exe", "guid": "{0ad3d447-8f3d-513c-99e1-447b1dcda84a}", "hidden": false, "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png", "name": "Command Prompt (admin)", "startingDirectory": "%USERPROFILE%" }, { "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "hidden": false, "name": "Windows PowerShell" }, { "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", "hidden": false, "name": "Azure Cloud Shell", "source": "Windows.Terminal.Azure" }, { "guid": "{a3a2e83a-884a-5379-baa8-16f193a13b21}", "hidden": false, "name": "PowerShell 7 Preview", "source": "Windows.Terminal.PowershellCore" }, { "guid": "{dc505395-c460-59d1-93a6-434a5808d193}", "hidden": false, "name": "Developer Command Prompt for VS 2022", "source": "Windows.Terminal.VisualStudio" }, { "guid": "{d050a9e6-e1c2-5609-9f92-4c711743606d}", "hidden": false, "name": "Developer PowerShell for VS 2022", "source": "Windows.Terminal.VisualStudio" } ] }, "schemes": [ { "background": "#002B36", "black": "#171421", "blue": "#2A7BDE", "brightBlack": "#5E5C64", "brightBlue": "#308DFF", "brightCyan": "#33C7DE", "brightGreen": "#33D17A", "brightPurple": "#C061CB", "brightRed": "#F66151", "brightWhite": "#FFFFFF", "brightYellow": "#FFFD00", "cursorColor": "#FFFFFF", "cyan": "#2AA1B3", "foreground": "#839496", "green": "#26A269", "name": "MyTheme", "purple": "#A347BA", "red": "#C01C28", "selectionBackground": "#FFFFFF", "white": "#D0CFCC", "yellow": "#CECB00" }, { "background": "#0C0C0C", "black": "#0C0C0C", "blue": "#0037DA", "brightBlack": "#767676", "brightBlue": "#3B78FF", "brightCyan": "#61D6D6", "brightGreen": "#16C60C", "brightPurple": "#B4009E", "brightRed": "#E74856", "brightWhite": "#F2F2F2", "brightYellow": "#F9F1A5", "cursorColor": "#FFFFFF", "cyan": "#3A96DD", "foreground": "#CCCCCC", "green": "#13A10E", "name": "Campbell", "purple": "#881798", "red": "#C50F1F", "selectionBackground": "#FFFFFF", "white": "#CCCCCC", "yellow": "#C19C00" }, { "background": "#012456", "black": "#0C0C0C", "blue": "#0037DA", "brightBlack": "#767676", "brightBlue": "#3B78FF", "brightCyan": "#61D6D6", "brightGreen": "#16C60C", "brightPurple": "#B4009E", "brightRed": "#E74856", "brightWhite": "#F2F2F2", "brightYellow": "#F9F1A5", "cursorColor": "#FFFFFF", "cyan": "#3A96DD", "foreground": "#CCCCCC", "green": "#13A10E", "name": "Campbell Powershell", "purple": "#881798", "red": "#C50F1F", "selectionBackground": "#FFFFFF", "white": "#CCCCCC", "yellow": "#C19C00" }, { "background": "#282C34", "black": "#282C34", "blue": "#61AFEF", "brightBlack": "#5A6374", "brightBlue": "#61AFEF", "brightCyan": "#56B6C2", "brightGreen": "#98C379", "brightPurple": "#C678DD", "brightRed": "#E06C75", "brightWhite": "#DCDFE4", "brightYellow": "#E5C07B", "cursorColor": "#FFFFFF", "cyan": "#56B6C2", "foreground": "#DCDFE4", "green": "#98C379", "name": "One Half Dark", "purple": "#C678DD", "red": "#E06C75", "selectionBackground": "#FFFFFF", "white": "#DCDFE4", "yellow": "#E5C07B" }, { "background": "#FAFAFA", "black": "#383A42", "blue": "#0184BC", "brightBlack": "#4F525D", "brightBlue": "#61AFEF", "brightCyan": "#56B5C1", "brightGreen": "#98C379", "brightPurple": "#C577DD", "brightRed": "#DF6C75", "brightWhite": "#FFFFFF", "brightYellow": "#E4C07A", "cursorColor": "#4F525D", "cyan": "#0997B3", "foreground": "#383A42", "green": "#50A14F", "name": "One Half Light", "purple": "#A626A4", "red": "#E45649", "selectionBackground": "#FFFFFF", "white": "#FAFAFA", "yellow": "#C18301" }, { "background": "#002B36", "black": "#4F6066", "blue": "#268BD2", "brightBlack": "#47565C", "brightBlue": "#839496", "brightCyan": "#93A1A1", "brightGreen": "#586E75", "brightPurple": "#6C71C4", "brightRed": "#CB4B16", "brightWhite": "#FDF6E3", "brightYellow": "#657B83", "cursorColor": "#FFFFFF", "cyan": "#2AA198", "foreground": "#839496", "green": "#859900", "name": "Solarized Dark", "purple": "#D33682", "red": "#DC322F", "selectionBackground": "#FFFFFF", "white": "#EEE8D5", "yellow": "#B58900" }, { "background": "#FDF6E3", "black": "#002B36", "blue": "#268BD2", "brightBlack": "#073642", "brightBlue": "#839496", "brightCyan": "#93A1A1", "brightGreen": "#586E75", "brightPurple": "#6C71C4", "brightRed": "#CB4B16", "brightWhite": "#FDF6E3", "brightYellow": "#657B83", "cursorColor": "#002B36", "cyan": "#2AA198", "foreground": "#657B83", "green": "#859900", "name": "Solarized Light", "purple": "#D33682", "red": "#DC322F", "selectionBackground": "#FFFFFF", "white": "#EEE8D5", "yellow": "#B58900" }, { "background": "#000000", "black": "#000000", "blue": "#3465A4", "brightBlack": "#555753", "brightBlue": "#729FCF", "brightCyan": "#34E2E2", "brightGreen": "#8AE234", "brightPurple": "#AD7FA8", "brightRed": "#EF2929", "brightWhite": "#EEEEEC", "brightYellow": "#FCE94F", "cursorColor": "#FFFFFF", "cyan": "#06989A", "foreground": "#D3D7CF", "green": "#4E9A06", "name": "Tango Dark", "purple": "#75507B", "red": "#CC0000", "selectionBackground": "#FFFFFF", "white": "#D3D7CF", "yellow": "#C4A000" }, { "background": "#FFFFFF", "black": "#000000", "blue": "#3465A4", "brightBlack": "#555753", "brightBlue": "#729FCF", "brightCyan": "#34E2E2", "brightGreen": "#8AE234", "brightPurple": "#AD7FA8", "brightRed": "#EF2929", "brightWhite": "#EEEEEC", "brightYellow": "#FCE94F", "cursorColor": "#000000", "cyan": "#06989A", "foreground": "#555753", "green": "#4E9A06", "name": "Tango Light", "purple": "#75507B", "red": "#CC0000", "selectionBackground": "#FFFFFF", "white": "#D3D7CF", "yellow": "#C4A000" }, { "background": "#000000", "black": "#000000", "blue": "#000080", "brightBlack": "#808080", "brightBlue": "#0000FF", "brightCyan": "#00FFFF", "brightGreen": "#00FF00", "brightPurple": "#FF00FF", "brightRed": "#FF0000", "brightWhite": "#FFFFFF", "brightYellow": "#FFFF00", "cursorColor": "#FFFFFF", "cyan": "#008080", "foreground": "#C0C0C0", "green": "#008000", "name": "Vintage", "purple": "#800080", "red": "#800000", "selectionBackground": "#FFFFFF", "white": "#C0C0C0", "yellow": "#808000" } ] } ```
Author
Owner

@DHowett commented on GitHub (Jun 20, 2022):

Automatic lightness is disabled in all public builds... hmm.

This looks like an explicit choice on behalf of the .NET folks, because it is totally possible using a non-.NET application to select the "white" color.

@DHowett commented on GitHub (Jun 20, 2022): Automatic lightness is disabled in all public builds... hmm. This looks like an explicit choice on behalf of the .NET folks, because it is totally possible using a non-.NET application to select the "white" color.
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

I found this problem while using a custom prompt application (https://github.com/JanDeDobbeleer/oh-my-posh/) written in GO, so it is not a .NET specific thing. Can anyone with any programming language create a sample where white foreground looks as expected and not the default "foreground"?

@ADIX7 commented on GitHub (Jun 20, 2022): I found this problem while using a custom prompt application (https://github.com/JanDeDobbeleer/oh-my-posh/) written in GO, so it is not a .NET specific thing. Can anyone with any programming language create a sample where white foreground looks as expected and not the default "foreground"?
Author
Owner

@zadjii-msft commented on GitHub (Jun 20, 2022):

printf "\x1b[0mDefault\n\x1b[37mWhite-on-default\x1b[m\n\x1b[37;47mWhite-on-white\x1b[m\n"

image

In a color scheme where default FG is black, not white:
image

@zadjii-msft commented on GitHub (Jun 20, 2022): `printf "\x1b[0mDefault\n\x1b[37mWhite-on-default\x1b[m\n\x1b[37;47mWhite-on-white\x1b[m\n"` ![image](https://user-images.githubusercontent.com/18356694/174680138-317be449-2357-4a02-a9ee-eede70e2c681.png) In a color scheme where default FG is black, not white: ![image](https://user-images.githubusercontent.com/18356694/174680229-1558c245-3ca4-4b96-8987-f5bf18295a97.png)
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

kép

@ADIX7 commented on GitHub (Jun 20, 2022): ![kép](https://user-images.githubusercontent.com/10939090/174680671-1f6e7061-5e23-455b-ba44-187efb71a2aa.png)
Author
Owner

@DHowett commented on GitHub (Jun 20, 2022):

There is a process policy that applies only to powershell that translates White FG and Black BG to Default and Default, owing to a bug they shipped in Windows. That issue is documented in #6810.

I suspect that is why Mike tested it with bash. Notably: this quirk only applies to executables named powershell.exe and pwsh.exe.

@DHowett commented on GitHub (Jun 20, 2022): There is a process policy that applies *only to powershell* that translates White FG and Black BG to Default and Default, owing to a bug they shipped in Windows. That issue is documented in #6810. I suspect that is why Mike tested it with bash. Notably: this quirk only applies to executables named `powershell.exe` and `pwsh.exe`.
Author
Owner

@zadjii-msft commented on GitHub (Jun 20, 2022):

Meh, that's not why - I'm just quicker on the draw in bash 😄 But that was my next theory as well. So, basically this is a duplicate of #6807?

@zadjii-msft commented on GitHub (Jun 20, 2022): Meh, that's not _why_ - I'm just quicker on the draw in `bash` 😄 But that was my next theory as well. So, basically this is a duplicate of #6807?
Author
Owner

@DHowett commented on GitHub (Jun 20, 2022):

It shouldn't be. Again, it only applies to executables named pwsh.exe and powershell.exe... ADIX's Go binary is certainly not named that, nor is dotnet.exe...

@DHowett commented on GitHub (Jun 20, 2022): It shouldn't be. Again, it _only applies to executables named `pwsh.exe` and `powershell.exe`_... ADIX's Go binary is certainly not named that, nor is `dotnet.exe`...
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

Hmmmmm, it might be the prompt app only generates the prompt as a string but at the end powershell is the one writing it...
@JanDeDobbeleer can you help with this?

Also, it's funny, if you check my settings.json I have a profile for "admin powershell" with "commandline": "gsudo \"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"", and it does work as it should be.

Disclamer: it's not my prompt app, I'm just using it.

kép

@ADIX7 commented on GitHub (Jun 20, 2022): Hmmmmm, it might be the prompt app only generates the prompt as a string but at the end powershell is the one writing it... @JanDeDobbeleer can you help with this? Also, it's funny, if you check my settings.json I have a profile for "admin powershell" with `"commandline": "gsudo \"C:\\Program Files\\PowerShell\\7\\pwsh.exe\""`, and it does work as it should be. *Disclamer: it's not my prompt app, I'm just using it.* ![kép](https://user-images.githubusercontent.com/10939090/174682546-72fd7414-e49f-4785-9925-8ee22b14766e.png)
Author
Owner

@zadjii-msft commented on GitHub (Jun 20, 2022):

I'm under the impression that's exactly how oh-my-posh works. It just informs pwsh how to format the prompt, pwsh.exe is still the thing writing the prompt to the terminal.

In the gsudo case, the actual root process attached to the console is gsudo, not pwsh, so the compat shim doesn't trigger.

But Dustin's got a good point, the repro script above shouldn't be triggering this compat shim at all. That's weird.

@zadjii-msft commented on GitHub (Jun 20, 2022): I'm under the impression that's _exactly_ how oh-my-posh works. It just informs `pwsh` how to format the prompt, `pwsh.exe` is still the thing writing the prompt to the terminal. In the `gsudo` case, the actual root process attached to the console is _gsudo_, not `pwsh`, so the compat shim doesn't trigger. But Dustin's got a good point, the repro script above _shouldn't_ be triggering this compat shim at all. That's weird.
Author
Owner

@ADIX7 commented on GitHub (Jun 20, 2022):

Is there anything I can use to disable this functionality? Some escape sequence at the beginning of the string?

@ADIX7 commented on GitHub (Jun 20, 2022): Is there anything I can use to disable this functionality? Some escape sequence at the beginning of the string?
Author
Owner

@DHowett commented on GitHub (Jun 20, 2022):

Hmm. As a quick fix, you can use indexed colors 0 and 7 from the 256-color palette:

image
@DHowett commented on GitHub (Jun 20, 2022): Hmm. As a quick fix, you can use indexed colors 0 and 7 from the 256-color palette: <img width="558" alt="image" src="https://user-images.githubusercontent.com/189190/174683989-f0c65ef9-d6f0-4eb6-8131-e0839b436801.png">
Author
Owner

@ADIX7 commented on GitHub (Jun 21, 2022):

Unfortunately oh-my-posh does not support the 256-color palett. But it is a good idea, thank you, I will create a feature request there!

@ADIX7 commented on GitHub (Jun 21, 2022): Unfortunately oh-my-posh does not support the 256-color palett. But it is a good idea, thank you, I will create a feature request there!
Author
Owner

@JanDeDobbeleer commented on GitHub (Jun 21, 2022):

Yes, oh-my-posh provides a string to PowerShell which writes it. I'm however not planning to add support for 256 colors as we already have hex support (which is 256) and tbh not many end users will want to/understand ANSI escape sequences. Adding that is also a challenge.

Let me get the conditions straight. When in powershell and Windows Terminal, I should replace the two white colors with index 0 and 7? Because that I can do. If someone could help me map the right values, that would be ace. Right now we have the following:

  • White FG: \e[37m
  • Black BG: \e[40m
@JanDeDobbeleer commented on GitHub (Jun 21, 2022): Yes, oh-my-posh provides a string to PowerShell which writes it. I'm however not planning to add support for 256 colors as we already have hex support (which is 256) and tbh not many end users will want to/understand ANSI escape sequences. Adding that is also a challenge. Let me get the conditions straight. When in powershell and Windows Terminal, I should replace the two white colors with index 0 and 7? Because that I can do. If someone could help me map the right values, that would be ace. Right now we have the following: - White FG: `\e[37m` - Black BG: `\e[40m`
Author
Owner

@DHowett commented on GitHub (Jun 21, 2022):

Honestly, it might be better to wait for #13352 to land. You won't need to think about what colors should map to which indices any longer after that's been released broadly!

For completeness, though: my original recommendation was going to be to map White FG to \e[38;2;7m and Black BG to \e[48;2;0m. Since those aren't the sequences that PowerShell was using, we didn't have to break those -- they continue to mean "actually white foreground" and "actually black background".

I'm gonna close this as a /dupe of #6807, since it looks like that's what it ended up being!

@DHowett commented on GitHub (Jun 21, 2022): Honestly, it might be better to wait for #13352 to land. You won't need to think about what colors should map to which indices any longer after that's been released broadly! For completeness, though: my original recommendation was going to be to map White FG to `\e[38;2;7m` and Black BG to `\e[48;2;0m`. Since those aren't the sequences that PowerShell was using, we didn't have to break those -- they continue to mean "actually white foreground" and "actually black background". I'm gonna close this as a /dupe of #6807, since it looks like that's what it ended up being!
Author
Owner

@ghost commented on GitHub (Jun 21, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jun 21, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17760