def validate_hex_color(value):
    """Validates that the given value is a hex color string or css name.

    Args:
        value: a value

    Raises:
        ValueError: if ``value`` is not a hex color string
    """
    if not etau.is_str(value) or not re.search(
        r"^#(?:[0-9a-fA-F]{3}){1,2}$", value
    ):
        raise ValueError(
            "%s is not a valid hex color string (eg: '#FF6D04')" % value
        )
Validates that the given value is a hex color string or css name.

    Args:
        value: a value

    Raises:
        ValueError: if ``value`` is not a hex color string
    
fiftyone/core/utils.py