From 1a5b1f4cd4af5307fc000a24fc50cb7347c82bbe Mon Sep 17 00:00:00 2001 From: tfuxu <73042332+tfuxu@users.noreply.github.com> Date: Sun, 14 May 2023 17:47:58 +0200 Subject: [PATCH] fix(utils/colors): properly sanitize color values * fix(utils/colors): remove references to old functions --- gradience/backend/utils/colors.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gradience/backend/utils/colors.py b/gradience/backend/utils/colors.py index bf2a764c..3c312368 100644 --- a/gradience/backend/utils/colors.py +++ b/gradience/backend/utils/colors.py @@ -105,14 +105,16 @@ def color_vars_to_color_code(variables: dict, palette: dict) -> dict: elif var_type == "variable": output[variable] = output[color_value] - if __has_variable_prefix(output[variable]): - __update_variable_vars(variable, output[variable]) + color_variable_name = output[variable].strip()[1:] if __has_palette_prefix(output[variable]): - __update_palette_vars(variable, output[variable]) + __update_vars("palette", variable, color_variable_name) + + if __has_variable_prefix(output[variable]): + __update_vars("variable", variable, color_variable_name) for variable, color in output.items(): - color_value = color[1:] # Remove '@' from the beginning of the color variable + color_value = color.strip()[1:] # Strip spaces and remove '@' from the beginning of the color variable if __has_palette_prefix(color_value) and palette != None: __update_vars("palette", variable, color_value)