    def __init__(self, raw_text, parser, colour=None, colour_map=None, offsets=None, text=None):
        """
        :param raw_text: The raw unicode string to be processed
        :param parser: The parser to process the text
        :param colour: Optional starting colour tuple to use for this text.
        :param colour_map: Optional ready parsed colour map for this text.
        :param offsets: Optional ready parsed offsets for this text.
        :param text: Optional ready parsed text for this text.

        The colour_map, offsets and text options are to optimize creation of substrings from an
        existing ColouredText object and should not be used in general.
        """
        super().__init__()
        self._raw_text = raw_text
        self._raw_offsets = []
        self._parser = parser
        self._colour_map = None
        self._last_colour = colour if colour else (None, None, None)
        self._init_colour = colour
        self._colour_map = []
        self._text = ""
        if colour_map:
            self._colour_map = colour_map
            self._last_colour = colour_map[-1]
            self._raw_offsets = offsets
            self._text = text
        else:
            self._parser.reset(self._raw_text, self._init_colour)
            for offset, command, params in self._parser.parse():
                if command == Parser.DISPLAY_TEXT:
                    self._colour_map.append(self._last_colour)
                    self._raw_offsets.append(offset)
                    self._text += params
                elif command == Parser.CHANGE_COLOURS:
                    self._last_colour = params
:param raw_text: The raw unicode string to be processed
:param parser: The parser to process the text
:param colour: Optional starting colour tuple to use for this text.
:param colour_map: Optional ready parsed colour map for this text.
:param offsets: Optional ready parsed offsets for this text.
:param text: Optional ready parsed text for this text.

The colour_map, offsets and text options are to optimize creation of substrings from an
existing ColouredText object and should not be used in general.
asciimatics/strings.py