def __call__(self, text, *styles, original_length=False):
        ''' Formats text.  Not appropriate for huge input strings.

            Arguments:
                text                Original text.
                *styles             Add "mix-in" styles, per invocation.
                original_length     bool - Save original string length for
                                    later use.

            Note:
                Color sequences are terminated at newlines,
                so that paging the output works correctly.
        '''
        if not text:  # when an empty string is passed, don't emit codes.
            return ''

        # if the category of styles is different,
        # copy uses fx.end instead of palette.default, see addition:
        for attr in styles:
            self += attr

        pos = text.find('\n', 0, MAX_NL_SEARCH)  # if '\n' in text, w/limit
        if pos != -1:  # found
            lines = text.splitlines()
            for i, line in enumerate(lines):
                lines[i] = f'{self}{line}{self.default}'  # add styles, see tip
            result = '\n'.join(lines)
        else:
            result = f'{self}{text}{self.default}'

        if original_length:
            return _LengthyString(len(text), result)
        else:
            return result
def __call__ ( self , text , * styles , original_length = False ) : if not text : return '' for attr in styles : self += attr pos = text . find ( '\n' , 0 , MAX_NL_SEARCH ) if pos != - 1 : lines = text . splitlines ( ) for i , line in enumerate ( lines ) : lines [ i ] = f'{self}{line}{self.default}' result = '\n' . join ( lines ) else : result = f'{self}{text}{self.default}' if original_length : return _LengthyString ( len ( text ) , result ) else : return result
Formats text.  Not appropriate for huge input strings.

            Arguments:
                text                Original text.
                *styles             Add "mix-in" styles, per invocation.
                original_length     bool - Save original string length for
                                    later use.

            Note:
                Color sequences are terminated at newlines,
                so that paging the output works correctly.