"""Color functions for Mariner."""

from typing import Any

import colorama

_COLORS = {
    "blue": colorama.Fore.BLUE,
    "cyan": colorama.Fore.CYAN,
    "green": colorama.Fore.GREEN,
    "red": colorama.Fore.RED,
    "yellow": colorama.Fore.YELLOW,
}


def color(string: Any, text_color: str) -> str:
    """Color string in given color.

    Arguments:
        string: String to color.
        text_color: Color to use.

    Returns:
        Colored string.

    """
    if text_color not in _COLORS:
        raise ValueError(f"{text_color} is not a supported color.")
    return str(_COLORS[text_color]) + str(string) + str(colorama.Style.RESET_ALL)


def cyan(string: Any) -> str:
    """Color string cyan."""
    return color(string, "cyan")


def green(string: Any) -> str:
    """Color string green."""
    return color(string, "green")


def red(string: Any) -> str:
    """Color string red."""
    return color(string, "red")


def yellow(string: Any) -> str:
    """Color string yellow."""
    return color(string, "yellow")
