Default color indices set through SetConsoleScreenBufferInfoEx do not propagate to the propsheet #6050

Open
opened 2026-01-31 00:28:37 +00:00 by claunia · 3 comments
Owner

Originally created by @deniskovalchuk on GitHub (Jan 20, 2020).

Environment

Windows build number: 10.0.18363.0

Steps to reproduce

  1. Create a new "Windows Console Application" project.
  2. Compile and run the code.
#include <windows.h>
#include <stdio.h>

int main()
{
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if (hStdOut == INVALID_HANDLE_VALUE)
    {
        fprintf(stderr, "GetStdHandle() failed.");
        return 1;
    }

    CONSOLE_SCREEN_BUFFER_INFOEX info = { 0 };
    info.cbSize = sizeof(info);

    if (!GetConsoleScreenBufferInfoEx(hStdOut, &info))
    {
        fprintf(stderr, "GetConsoleScreenBufferInfoEx() failed.");
        return 1;
    }

    // Set color #6 as the foreground color and color #3 as the background color.
    info.wAttributes = FOREGROUND_GREEN | FOREGROUND_RED |
                       BACKGROUND_GREEN | BACKGROUND_BLUE;

    // Set color #6 as the foreground color and color #3 as the background color.
    info.wPopupAttributes = FOREGROUND_GREEN | FOREGROUND_RED |
    			    BACKGROUND_GREEN | BACKGROUND_BLUE;

    if (!SetConsoleScreenBufferInfoEx(hStdOut, &info))
    {
        fprintf(stderr, "SetConsoleScreenBufferInfoEx() failed.");
        return 1;
    }

    return 0;
}
  1. Open the "Properties" page.
  2. Select the "Colors" tab.

Expected behavior

Screen colors and popup colors should be consistent with the colors set through the SetConsoleScreenBufferInfoEx function.

Behavior on Windows 10.0.17134.0.

colors-expected

Actual behavior

Screen colors and popup colors are set to default state.

colors-actual

Note that setting the color table through the SetConsoleScreenBufferInfoEx function works as expected.

Originally created by @deniskovalchuk on GitHub (Jan 20, 2020). # Environment ```none Windows build number: 10.0.18363.0 ``` # Steps to reproduce 1. Create a new "Windows Console Application" project. 2. Compile and run the code. ```cpp #include <windows.h> #include <stdio.h> int main() { HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); if (hStdOut == INVALID_HANDLE_VALUE) { fprintf(stderr, "GetStdHandle() failed."); return 1; } CONSOLE_SCREEN_BUFFER_INFOEX info = { 0 }; info.cbSize = sizeof(info); if (!GetConsoleScreenBufferInfoEx(hStdOut, &info)) { fprintf(stderr, "GetConsoleScreenBufferInfoEx() failed."); return 1; } // Set color #6 as the foreground color and color #3 as the background color. info.wAttributes = FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; // Set color #6 as the foreground color and color #3 as the background color. info.wPopupAttributes = FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; if (!SetConsoleScreenBufferInfoEx(hStdOut, &info)) { fprintf(stderr, "SetConsoleScreenBufferInfoEx() failed."); return 1; } return 0; } ``` 3. Open the "Properties" page. 4. Select the "Colors" tab. # Expected behavior Screen colors and popup colors should be consistent with the colors set through the `SetConsoleScreenBufferInfoEx` function. Behavior on Windows 10.0.17134.0. ![colors-expected](https://user-images.githubusercontent.com/15797194/72721218-90432080-3b8c-11ea-8921-972bc2ad0fb3.png) # Actual behavior Screen colors and popup colors are set to default state. ![colors-actual](https://user-images.githubusercontent.com/15797194/72716575-81a43b80-3b83-11ea-9b3d-f4f702575ec3.png) Note that setting the color table through the `SetConsoleScreenBufferInfoEx` function works as expected.
claunia added the Product-ConhostArea-SettingsIssue-BugPriority-2 labels 2026-01-31 00:28:37 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 24, 2020):

Oh no. Ohhh no. It looks like we're no longer propagating the default fill attributes from the screen buffer to the "global console info" settings before we stuff it into the property sheet.

I'll run a git blame to figure out why.

@DHowett-MSFT commented on GitHub (Jan 24, 2020): Oh no. Ohhh no. It looks like we're no longer propagating the default fill attributes from the screen buffer to the "global console info" settings before we stuff it into the property sheet. I'll run a git blame to figure out why.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 24, 2020):

It looks like this regressed in Nov 2018 when we fixed MSFT:19781479.

@DHowett-MSFT commented on GitHub (Jan 24, 2020): It looks like this regressed in Nov 2018 when we fixed MSFT:19781479.
Author
Owner

@j4james commented on GitHub (Jan 6, 2022):

Fixing this for the popup colors should be easy. Just add the following to SetConsoleScreenBufferInfoExImpl:

gci.SetPopupFillAttribute(data.wPopupAttributes);

Technically we could do the same thing for the screen colors, but I suspect that's not what we want, because the screen colors no longer have the same meaning as the did in the v1 console. As far as I can tell, they used to represent the current/active colors, but they now just represent the default colors.

@j4james commented on GitHub (Jan 6, 2022): Fixing this for the popup colors should be easy. Just add the following to `SetConsoleScreenBufferInfoExImpl`: ``` gci.SetPopupFillAttribute(data.wPopupAttributes); ``` Technically we could do the same thing for the screen colors, but I suspect that's not what we want, because the screen colors no longer have the same meaning as the did in the v1 console. As far as I can tell, they used to represent the current/active colors, but they now just represent the default colors.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6050