mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-05-30 22:47:14 +02:00
General: Cleanup
This commit is contained in:
parent
d81e17945a
commit
f391a4fcb2
22
wal.py
22
wal.py
@ -109,11 +109,7 @@ def process_colors(args):
|
|||||||
|
|
||||||
# Import the colorscheme from file.
|
# Import the colorscheme from file.
|
||||||
if cache_file.is_file():
|
if cache_file.is_file():
|
||||||
with open(cache_file) as file:
|
colors = read_colors(cache_file)
|
||||||
colors = file.readlines()
|
|
||||||
|
|
||||||
# Strip newlines from each list element.
|
|
||||||
colors = [x.strip() for x in colors]
|
|
||||||
|
|
||||||
if len(colors) < 16:
|
if len(colors) < 16:
|
||||||
print("error: Invalid colorscheme file chosen.")
|
print("error: Invalid colorscheme file chosen.")
|
||||||
@ -125,6 +121,17 @@ def process_colors(args):
|
|||||||
return colors
|
return colors
|
||||||
|
|
||||||
|
|
||||||
|
def read_colors(color_file):
|
||||||
|
"""Read colors from a file"""
|
||||||
|
with open(color_file) as file:
|
||||||
|
colors = file.readlines()
|
||||||
|
|
||||||
|
# Strip newlines from each list element.
|
||||||
|
colors = [x.strip() for x in colors]
|
||||||
|
|
||||||
|
return colors
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
@ -222,11 +229,8 @@ def get_colors(img):
|
|||||||
file.write("%s\n" % (img))
|
file.write("%s\n" % (img))
|
||||||
|
|
||||||
if cache_file.is_file():
|
if cache_file.is_file():
|
||||||
with open(cache_file) as file:
|
colors = read_colors(cache_file)
|
||||||
colors = file.readlines()
|
|
||||||
|
|
||||||
# Strip newlines from each list element.
|
|
||||||
colors = [x.strip() for x in colors]
|
|
||||||
else:
|
else:
|
||||||
print("colors: Generating a colorscheme...")
|
print("colors: Generating a colorscheme...")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user