def get_color(name, stream=STD_OUTPUT_HANDLE):
stream = kernel32.GetStdHandle(stream)<EOL>csbi = CONSOLE_SCREEN_BUFFER_INFO()<EOL>kernel32.GetConsoleScreenBufferInfo(stream, byref(csbi))<EOL>color_id = csbi.wAttributes & _mask_map.get(name, name)<EOL>log.debug('<STR_LIT>', color_id)<EOL>if name in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>color_id /= <NUM_LIT:16>  <EOL>log.debug('<STR_LIT>', color_id)<EOL><DEDENT>color_id = _win_to_ansi_offset_map.get(color_id, color_id)<EOL>log.debug('<STR_LIT>', color_id)<EOL>return color_id<EOL>
Returns current colors of console.

        https://docs.microsoft.com/en-us/windows/console/getconsolescreenbufferinfo

        Arguments:
            name:   one of ('background', 'bg', 'foreground', 'fg')
            stream: Handle to stdout, stderr, etc.

        Returns:
            int:  a color id from the conhost palette.
                  Ids under 0x8 (8) are dark colors, above light.