(self, attr)
return fore, back, blink, underline
Split attribute byte into constituent parts.
Split attribute byte into constituent parts.
Split attribute byte into constituent parts .
def split_attr(self, attr):
        """Split attribute byte into constituent parts."""
        underline = (attr % 8) == 1
        blink = (attr & 0x80) != 0
        # background is almost always black
        back = 0
        # intensity set by bit 3
        fore = 2 if not (attr & 0x8) else 3
        # exceptions
        if attr in (0x00, 0x08, 0x80, 0x88):
            fore, back = 0, 0
        elif attr in (0x70, 0xf0):
            fore, back = 0, 2
        elif attr in (0x78, 0xf8):
            fore, back = 1, 3
        return fore, back, blink, underline
def split_attr ( self , attr ) : underline = ( attr % 8 ) == 1 blink = ( attr & 0x80 ) != 0 # background is almost always black back = 0 # intensity set by bit 3 fore = 2 if not ( attr & 0x8 ) else 3 # exceptions if attr in ( 0x00 , 0x08 , 0x80 , 0x88 ) : fore , back = 0 , 0 elif attr in ( 0x70 , 0xf0 ) : fore , back = 0 , 2 elif attr in ( 0x78 , 0xf8 ) : fore , back = 1 , 3 return fore , back , blink , underline