'Creates a new color scheme with a custom name.'

def create_new_scheme(self):

    names = self.get_option('names')
    custom_names = self.get_option('custom_names', [])
    counter = (len(custom_names) - 1)
    custom_index = [int(n.split('-')[(-1)]) for n in custom_names]
    for i in range(len(custom_names)):
        if (custom_index[i] != i):
            counter = (i - 1)
            break
    custom_name = 'custom-{0}'.format((counter + 1))
    custom_names.append(custom_name)
    self.set_option('custom_names', custom_names)
    for key in syntaxhighlighters.COLOR_SCHEME_KEYS:
        name = '{0}/{1}'.format(custom_name, key)
        default_name = '{0}/{1}'.format(self.current_scheme, key)
        option = self.get_option(default_name)
        self.set_option(name, option)
    self.set_option('{0}/name'.format(custom_name), custom_name)
    dlg = self.scheme_editor_dialog
    dlg.add_color_scheme_stack(custom_name, custom=True)
    dlg.set_scheme(custom_name)
    self.load_from_conf()
    if dlg.exec_():
        name = dlg.get_scheme_name()
        self.set_option('{0}/name'.format(custom_name), name)
        index = ((names + custom_names).index(custom_name) + 1)
        self.update_combobox()
        self.schemes_combobox.setCurrentIndex(index)
    else:
        custom_names.remove(custom_name)
        self.set_option('custom_names', custom_names)
        dlg.delete_color_scheme_stack(custom_name)
