<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_color_index(ansi_string):
 """Build an index between visible characters and a string with invisible color codes. :param str ansi_string: String with color codes (ANSI escape sequences). :return: Position of visible characters in color string (indexes match non-color string). :rtype: tuple """

    mapping = list()
    color_offset = 0
    for item in (i for i in RE_SPLIT.split(ansi_string) if i):
        if RE_SPLIT.match(item):
            color_offset += len(item)
        else:
            for _ in range(len(item)):
                mapping.append(color_offset)
                color_offset += 1
    return tuple(mapping)