Parse and extract color/markup syntax from a format string.

def extract_syntax(self, syntax):
        """Parse and extract color/markup syntax from a format string."""
        tokens = syntax.split(self._COLOR_DELIM)
        r = [None, None]

        for token in tokens:
            for i, e in enumerate(('fg=', 'bg=')):
                if token.startswith(e):
                    r[i] = token[3:]

            if r == [None, None]:
                raise ColorSyntaxError("Unexpected color syntax '{0}'"
                                       .format(token))

        return tuple(r)