def as_colr(
            self, label_args=None, type_args=None, type_val_args=None,
            value_args=None, spec_args=None):
        """ Like __str__, except it returns a colorized Colr instance. """
        label_args = label_args or {'fore': 'red'}
        type_args = type_args or {'fore': 'yellow'}
        type_val_args = type_val_args or {'fore': 'grey'}
        value_args = value_args or {'fore': 'blue', 'style': 'bright'}
        spec_args = spec_args or {'fore': 'blue'}
        spec_repr = repr(self.spec)
        spec_quote = spec_repr[0]
        val_repr = repr(self.value)
        val_quote = val_repr[0]
        return Colr(self.default_format.format(
            label=Colr(':\n    ').join(
                Colr('Bad format spec. color name/value', **label_args),
                ',\n    '.join(
                    '{lbl:<5} ({val})'.format(
                        lbl=Colr(l, **type_args),
                        val=Colr(v, **type_val_args),
                    )
                    for l, v in self.accepted_values
                )
            ),
            spec=Colr('=').join(
                Colr(v, **spec_args)
                for v in spec_repr[1:-1].split('=')
            ).join((spec_quote, spec_quote)),
            value=Colr(
                val_repr[1:-1],
                **value_args
            ).join((val_quote, val_quote)),
        ))
def as_colr ( self , label_args = None , type_args = None , type_val_args = None , value_args = None , spec_args = None ) : label_args = label_args or { 'fore' : 'red' } type_args = type_args or { 'fore' : 'yellow' } type_val_args = type_val_args or { 'fore' : 'grey' } value_args = value_args or { 'fore' : 'blue' , 'style' : 'bright' } spec_args = spec_args or { 'fore' : 'blue' } spec_repr = repr ( self . spec ) spec_quote = spec_repr [ 0 ] val_repr = repr ( self . value ) val_quote = val_repr [ 0 ] return Colr ( self . default_format . format ( label = Colr ( ':\n    ' ) . join ( Colr ( 'Bad format spec. color name/value' , ** label_args ) , ',\n    ' . join ( '{lbl:<5} ({val})' . format ( lbl = Colr ( l , ** type_args ) , val = Colr ( v , ** type_val_args ) , ) for l , v in self . accepted_values ) ) , spec = Colr ( '=' ) . join ( Colr ( v , ** spec_args ) for v in spec_repr [ 1 : - 1 ] . split ( '=' ) ) . join ( ( spec_quote , spec_quote ) ) , value = Colr ( val_repr [ 1 : - 1 ] , ** value_args ) . join ( ( val_quote , val_quote ) ) , ) )
Like __str__, except it returns a colorized Colr instance.