from .formatter import Formatter


def cformat(string, **params):
    """Format string with styles and colors.
    """
    formatter = Formatter(
        codes=params.pop('codes', {}),
        styles=params.pop('styles', {}),
        targets=params.pop('targets', {}),
        colors=params.pop('colors', {}))
    result = formatter.format(string, **params)
    return result
