def completion(self, m):

        found = True
        if m.group('hash') and ('hex' in self.allowed_colors or 'hexa' in self.allowed_colors):
            self.region = sublime.Region(m.start('hash') + self.start, m.end('hash') + self.start)
        elif m.group('hash') and ('hex_compressed' in self.allowed_colors or 'hexa_compressed' in self.allowed_colors):
            self.region = sublime.Region(m.start('hash') + self.start, m.end('hash') + self.start)
        elif m.group('rgb_open') and 'rgb' in self.allowed_colors:
            offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('rgb_open') + self.start, m.end('rgb_open') + self.start + offset)
        elif m.group('rgba_open') and 'rgba' in self.allowed_colors:
            offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('rgba_open') + self.start, m.end('rgba_open') + self.start + offset)
            self.alpha = '1'
            self.alpha_hex = 'ff'
        elif m.group('gray_open') and ('gray' in self.allowed_colors or 'graya' in self.allowed_colors):
            offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('gray_open') + self.start, m.end('gray_open') + self.start + offset)
        elif m.group('hsl_open') and 'hsl' in self.allowed_colors:
            offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('hsl_open') + self.start, m.end('hsl_open') + self.start + offset)
        elif m.group('hsla_open') and 'hsla' in self.allowed_colors:
            self.offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('hsla_open') + self.start, m.end('hsla_open') + self.start + offset)
            self.alpha = '1'
            self.alpha_hex = 'ff'
        elif m.group('hwb_open') and ('hwb' in self.allowed_colors or 'hwba' in self.allowed_colors):
            offset = 1 if self.view.substr(self.point) == ')' else 0
            self.region = sublime.Region(m.start('hwb_open') + self.start, m.end('hwb_open') + self.start + offset)
        else:
            found = False
        return found
See if match is completing an color.
dataset/ETHPy150Open facelessuser/ColorHelper/color_helper_insert.py/InsertCalc.completion