diff options
| author | Chandler J <cjustice2000@gmail.com> | 2024-03-18 13:14:40 -0600 |
|---|---|---|
| committer | Chandler J <cjustice2000@gmail.com> | 2024-03-18 13:14:40 -0600 |
| commit | 0f6fd394f39406b76e8f18fe4c2ddb791194f978 (patch) | |
| tree | bcb56d1b0c019854eaf89a36e24f83356d6894dd /src/manage_saves.py | |
| parent | 83a3b5ebcc355e875c0d3f43a5a854e7194d6540 (diff) | |
began implementating save states for color palettes and MOAR POLISH
Diffstat (limited to 'src/manage_saves.py')
| -rw-r--r-- | src/manage_saves.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/manage_saves.py b/src/manage_saves.py new file mode 100644 index 0000000..988b9a2 --- /dev/null +++ b/src/manage_saves.py @@ -0,0 +1,21 @@ +import pickle +from rich import print + +def save_color_palette(hex_colors, hex_compliments, save_directory): + + colors = [hex_colors, hex_compliments] + + with open(save_directory, 'wb') as file: + pickle.dump(colors, file, pickle.HIGHEST_PROTOCOL) + + print('[bold green]color palette saved successfully') + +def load_color_palette(save_location): + with open(save_location, 'rb') as file: + try: + data = pickle.load(file) + except: + print('invalid arguments. -p should be followed by a color palette save') + exit(2) + + return data |
