diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-06-19 19:55:55 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-06-19 19:55:55 +1000 |
| commit | f391a4fcb262085f8fb03cfc77fcd2600415b40c (patch) | |
| tree | 04d2f7dad99ff7fe3f6c34e964050c1edeb1e489 /wal.py | |
| parent | d81e17945ad98aea0be696deaa44030a7e5937fb (diff) | |
General: Cleanup
Diffstat (limited to 'wal.py')
| -rwxr-xr-x | wal.py | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -109,11 +109,7 @@ def process_colors(args): # Import the colorscheme from file. if cache_file.is_file(): - with open(cache_file) as file: - colors = file.readlines() - - # Strip newlines from each list element. - colors = [x.strip() for x in colors] + colors = read_colors(cache_file) if len(colors) < 16: print("error: Invalid colorscheme file chosen.") @@ -125,6 +121,17 @@ def process_colors(args): 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)) if cache_file.is_file(): - with open(cache_file) as file: - colors = file.readlines() + colors = read_colors(cache_file) - # Strip newlines from each list element. - colors = [x.strip() for x in colors] else: print("colors: Generating a colorscheme...") |
