def calc(self):

        bfr = self.view.substr(sublime.Region(self.start, self.end))
        ref = self.point - self.start
        found = False

        for m in util.COLOR_ALL_RE.finditer(bfr):
            if ref >= m.start(0) and ref < m.end(0):
                found = self.replacement(m)
            elif ref == m.end(0):
                found = self.completion(m)
            elif ref < m.start(0):
                break

            if found:
                break

        self.convert_alpha()

        return found
Calculate how we are to insert the target color.
dataset/ETHPy150Open facelessuser/ColorHelper/color_helper_insert.py/InsertCalc.calc