summaryrefslogtreecommitdiff
path: root/src/manage_saves.py
diff options
context:
space:
mode:
authorChandler J <cjustice2000@gmail.com>2024-03-18 13:14:40 -0600
committerChandler J <cjustice2000@gmail.com>2024-03-18 13:14:40 -0600
commit0f6fd394f39406b76e8f18fe4c2ddb791194f978 (patch)
treebcb56d1b0c019854eaf89a36e24f83356d6894dd /src/manage_saves.py
parent83a3b5ebcc355e875c0d3f43a5a854e7194d6540 (diff)
began implementating save states for color palettes and MOAR POLISH
Diffstat (limited to 'src/manage_saves.py')
-rw-r--r--src/manage_saves.py21
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