def get_custom_color_format_info(color_value):
    """Return color format name and length of color value.

    The given color_value can be in different formats which
    are explained below. If the function returns without
    raising a ValueError, than we can say the the color
    value is a valid color representation. This is to say
    that this functions can also be used to validate
    color values, not only to retrieve the specific info.

    Parameters
    ==========
    color_value (string or tuple)
        value representing a color or tuple of colors;
        it can be:

        - a string in hex color format:
          e.g.: '#ff0000' or '#ff0000ff'
        - a tuple of integers from 0 to 255 where
          each integer represents the red, green, blue
          and/or alpha channel of a color.
          e.g.: (255, 0, 0) or (255, 0, 0, 255)
        - a tuple populated with strings or
          tuples in the formats presented above
          (you must use the same type for all values)

          e.g.:

            ('#ff0000', '#00ffffee', ...)

            or

            ((255, 0, 0), (0, 255, 255, 255), ...)

    Return value
    ============

    The return value is a 2-tuple with the following values:

    index 0: name of the format of the color value

       e.g.:

         'single_hex'   for '#ffffff'
         'multiple_hex' for ['#ffffff', '#ff0000', ...]
         'single_rgb'   for [255, 0, 0]
         'multiple_hex' for [[255, 0, 0], [0, 0, 255], ...]

    index 1: integer indicating how much colors the value
             actually represents (a length).
    """
    ### perform specific checks for when the color value is
    ### a tuple

    if isinstance(color_value, tuple):

        ## if all items are integers within a valid range
        ## and the length is either 3 or 4, we have a valid
        ## color representation, so we return its info

        if all(
            isinstance(item, int) and 0 <= item <= 255 for item in color_value
        ) and len(color_value) in (3, 4):

            return ("single_rgb", 1)

        ## if all items are all string which pass a custom
        ## validation, we have a valid color representation,
        ## so we return its info

        elif all(
            isinstance(item, str) and validate_hex_color_string(item)
            for item in color_value
        ):

            return ("multiple_hex", len(color_value))

        ## if all items are tuples of length 3 or 4 and
        ## their subitems are integers within a valid
        ## range, then we have a valid color
        ## representation, so we return its info

        elif all(
            isinstance(item, tuple)
            and len(item) in (3, 4)
            and all(
                isinstance(subitem, int) and 0 <= subitem <= 255 for subitem in item
            )
            for item in color_value
        ):
            return ("multiple_rgb", len(color_value))

    ### perform specific check for when the color value is
    ### a string, returning the info in case we have a
    ### a valid color representation (the test passes)

    elif isinstance(color_value, str) and validate_hex_color_string(color_value):
        return ("single_hex", 1)

    ### if we reach this point in the function, it means
    ### no "return" statement were reached since no test
    ### passed; since we don't have a valid color
    ### representation, we raise a ValueError

    raise ValueError(
        "color value must be either an hex string"
        " representing rgb(a) values ('#ffffff') or"
        " a tuple of rgb(a) values as integers"
        " from 0 to 255; you can also provide a"
        " tuple with such values, as long as"
        " you use the same type for all values"
    )
Return color format name and length of color value.

    The given color_value can be in different formats which
    are explained below. If the function returns without
    raising a ValueError, than we can say the the color
    value is a valid color representation. This is to say
    that this functions can also be used to validate
    color values, not only to retrieve the specific info.

    Parameters
    ==========
    color_value (string or tuple)
        value representing a color or tuple of colors;
        it can be:

        - a string in hex color format:
          e.g.: '#ff0000' or '#ff0000ff'
        - a tuple of integers from 0 to 255 where
          each integer represents the red, green, blue
          and/or alpha channel of a color.
          e.g.: (255, 0, 0) or (255, 0, 0, 255)
        - a tuple populated with strings or
          tuples in the formats presented above
          (you must use the same type for all values)

          e.g.:

            ('#ff0000', '#00ffffee', ...)

            or

            ((255, 0, 0), (0, 255, 255, 255), ...)

    Return value
    ============

    The return value is a 2-tuple with the following values:

    index 0: name of the format of the color value

       e.g.:

         'single_hex'   for '#ffffff'
         'multiple_hex' for ['#ffffff', '#ff0000', ...]
         'single_rgb'   for [255, 0, 0]
         'multiple_hex' for [[255, 0, 0], [0, 0, 255], ...]

    index 1: integer indicating how much colors the value
             actually represents (a length).
    
nodezator/ourstdlibs/color/custom.py