import re
import click


def highlight(text, highlight_strs, color):
    """
    Highlight specific strings or characters in text.
    See :py:func:`click.style` for supported colors.

    Args:
        text (str): Text containing strings to highlight
        highlight_strs (list): Specific strings to be highlighted
        color (str): Color to highlight with

    Returns:
        str: The provided ``text``, with added color (if ``highlight_strs`` were found)
    """
    for s in sorted(highlight_strs or [], key=len, reverse=True):
        # Add color, except for substrings that have already been colored (preceded by '[##m')
        text = re.sub(r'(?<!\[\d\dm)' + s, click.style(s, fg=color), text)
    return text