@colors.setter
    def colors(self, color_code):
        if color_code is None:
            color_code = WINDOWS_CODES['/all']

        # Get current color code.
        current_fg, current_bg = self.colors

        # Handle special negative codes. Also determine the final color code.
        if color_code == WINDOWS_CODES['/fg']:
            final_color_code = self.default_fg | current_bg  # Reset the foreground only.
        elif color_code == WINDOWS_CODES['/bg']:
            final_color_code = current_fg | self.default_bg  # Reset the background only.
        elif color_code == WINDOWS_CODES['/all']:
            final_color_code = self.default_fg | self.default_bg  # Reset both.
        elif color_code == WINDOWS_CODES['bgblack']:
            final_color_code = current_fg  # Black background.
        else:
            new_is_bg = color_code in self.ALL_BG_CODES
            final_color_code = color_code | (current_fg if new_is_bg else current_bg)

        # Set new code.
        self._kernel32.SetConsoleTextAttribute(self._stream_handle, final_color_code)
Change the foreground and background colors for subsequently printed characters.
dataset/ETHPy150Open Robpol86/colorclass/colorclass/windows.py/WindowsStream.colors