def fix_scheme_in_settings(settings_file,current_scheme, new_scheme, regenerate=False):
"""Change the color scheme in the given Settings to a background-corrected one"""
from os.path import join, normpath, isfile
settings = load_settings(settings_file)
settings_scheme = settings.get("color_scheme")
if current_scheme == settings_scheme:
new_scheme_path = join(packages_path(), normpath(new_scheme[len("Packages/"):]))
if isfile(new_scheme_path) and not regenerate:
settings.set("color_scheme", new_scheme)
else:
generate_scheme_fix(current_scheme, new_scheme_path)
settings.set("color_scheme", new_scheme)
save_settings(settings_file)
return True
return False
评论列表
文章目录