# Path: ronin/utils/unicode.py



from .unicode import to_str
from blessings import Terminal
import colorama, atexit
atexit.register(_restore_terminal)

terminal = Terminal()


def announce(message, prefix='rōnin', color='green'):
    """
    Writes a message to the terminal with a colored prefix.
    
    :param message: message
    :type message: str
    :param color: color name
    :type color: str
    """
    
    if color:
        prefix = getattr(terminal, color)(prefix)
    print('{}: {}'.format(prefix, message))


def error(message):
    """
    Writes an error message to the terminal with a red prefix.
    
    :param message: message or exception
    :type message: str or BaseException subclass instance
    """
    
    if isinstance(message, BaseException):
        the_type = type(message).__name__

# Path: ronin/utils/unicode.py



# Path: ronin/utils/messages.py
from .unicode import to_str
from blessings import Terminal
import colorama, atexit

atexit.register(_restore_terminal)

terminal = Terminal()


def announce(message, prefix='rōnin', color='green'):
    """
    Writes a message to the terminal with a colored prefix.
    
    :param message: message
    :type message: str
    :param color: color name
    :type color: str
    """
    
    if color:
        prefix = getattr(terminal, color)(prefix)
    print('{}: {}'.format(prefix, message))


def error(message):
    """
    Writes an error message to the terminal with a red prefix.
    
    :param message: message or exception
    :type message: str or BaseException subclass instance
    """
    
    if isinstance(message, BaseException):
        the_type = type(message).__name__

        message = to_str(message)