From 63b804a93939972f8495c10f9f501567e0ab938f Mon Sep 17 00:00:00 2001 From: luisbocanegra Date: Wed, 20 Apr 2022 15:13:45 -0500 Subject: [PATCH] python: misc: fix blend multiplier range --- schemeconfigs.py | 12 +++--------- utils.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/schemeconfigs.py b/schemeconfigs.py index c817214..a170949 100644 --- a/schemeconfigs.py +++ b/schemeconfigs.py @@ -1,14 +1,13 @@ from color_utils import blendColors -import numpy as np - +from utils import range_check class ThemeConfig: def __init__(self, colors, wallpaper_data, light_blend_multiplier=1, dark_blend_multiplier=1): colors_best = colors['bestColors'] tones_primary = colors['primaryTones'] tones_neutral = colors['neutralTones'] - light_blend_multiplier = multipler_check(light_blend_multiplier) - dark_blend_multiplier = multipler_check(dark_blend_multiplier) + light_blend_multiplier = range_check(light_blend_multiplier,0,4) + dark_blend_multiplier = range_check(dark_blend_multiplier,0,4) tone = 30 pywal_colors_dark = () @@ -376,8 +375,3 @@ def get_wal_light_scheme(self): def get_wal_dark_scheme(self): return (self._wal_dark_scheme) -def multipler_check(multiplier): - if multiplier != None: - return np.clip(multiplier,1,4) - else: - return 1 diff --git a/utils.py b/utils.py index f1e964b..5b78d79 100644 --- a/utils.py +++ b/utils.py @@ -148,14 +148,14 @@ def __init__(self, args): c_pywal_light = c_pywal_light if args.lbmultiplier != None: - c_light_blend_multiplier = np.clip(args.lbmultiplier, 0, 4) + c_light_blend_multiplier = range_check(args.lbmultiplier, 0, 4) elif c_light_blend_multiplier != None: - c_light_blend_multiplier = np.clip(c_light_blend_multiplier, 0, 4) + c_light_blend_multiplier = range_check(c_light_blend_multiplier, 0, 4) if args.dbmultiplier != None: - c_dark_blend_multiplier = np.clip(args.dbmultiplier, 0, 4) + c_dark_blend_multiplier = range_check(args.dbmultiplier, 0, 4) elif c_dark_blend_multiplier != None: - c_dark_blend_multiplier = np.clip(c_dark_blend_multiplier, 0, 4) + c_dark_blend_multiplier = range_check(c_dark_blend_multiplier, 0, 4) if args.file != None: c_file = args.file @@ -552,3 +552,9 @@ def kde_globals_light(): def run_hook(hook): if hook != None: subprocess.Popen(hook,shell=True) + +def range_check(x,min,max): + if x != None: + return np.clip(x,min,max) + else: + return 1