Skip to content

Commit

Permalink
python: misc: fix blend multiplier range
Browse files Browse the repository at this point in the history
  • Loading branch information
luisbocanegra committed Apr 20, 2022
1 parent 51632ae commit 63b804a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 3 additions & 9 deletions schemeconfigs.py
Original file line number Diff line number Diff line change
@@ -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 = ()
Expand Down Expand Up @@ -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
14 changes: 10 additions & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 63b804a

Please # to comment.