diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2018-03-31 11:28:28 +1100 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2018-03-31 11:28:28 +1100 |
| commit | 520b065a30152fb9639418ce0557d45c6a07d9a5 (patch) | |
| tree | 3faba953c0174960299a54c34a9d57c6f0cf8e28 /pywal/colors.py | |
| parent | 32792a0b98baa6c920ebd8fba74a5fa196ae1fd5 (diff) | |
backend: cleanup
Diffstat (limited to 'pywal/colors.py')
| -rw-r--r-- | pywal/colors.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pywal/colors.py b/pywal/colors.py index b0c6f49..a03dd26 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -24,6 +24,23 @@ def list_backends(): return "colorthief, colorz, wal" +def colors_to_dict(colors, img): + """Convert list of colors to pywal format.""" + scheme = {"wallpaper": img, + "alpha": util.Color.alpha_num, + "special": {}, + "colors": {}} + + for i, color in enumerate(colors): + scheme["colors"]["color%s" % i] = color + + scheme["special"]["background"] = colors[0] + scheme["special"]["foreground"] = colors[15] + scheme["special"]["cursor"] = colors[1] + + return scheme + + def gen(img, light=False, backend="wal", cache_dir=CACHE_DIR): """Generate a palette.""" # home_dylan_img_jpg_backend_1.2.2.json @@ -42,6 +59,7 @@ def gen(img, light=False, backend="wal", cache_dir=CACHE_DIR): print("wal: Generating a colorscheme...") colors = get(backend)(img, light) + colors = colors_to_dict(colors, img) util.save_file_json(colors, cache_file) print("wal: Generation complete.") |
