(self, attr_index)
return min(self._num_attr-1, max(0, attr_index))
Get the colour attribute for the specified index.
Get the colour attribute for the specified index.
Get the colour attribute for the specified index .
def _get_attr_index(self, attr_index):
        """Get the colour attribute for the specified index."""
        if attr_index == -1:
            # foreground; graphics 'background' attrib is always 0
            attr, _, _, _ = self._colourmap.split_attr(self._attr)
            return attr
        elif not attr_index:
            return 0
        return min(self._num_attr-1, max(0, attr_index))
def _get_attr_index ( self , attr_index ) : if attr_index == - 1 : # foreground; graphics 'background' attrib is always 0 attr , _ , _ , _ = self . _colourmap . split_attr ( self . _attr ) return attr elif not attr_index : return 0 return min ( self . _num_attr - 1 , max ( 0 , attr_index ) )