-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss-color-extractor.py
More file actions
59 lines (52 loc) · 2.11 KB
/
css-color-extractor.py
File metadata and controls
59 lines (52 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
import os
from colorama import Fore, init
from extract_colors import CSSColorExtractor
from utils.display import animated_title, show_menu
from utils.single_extract import extract_single_website
from utils.batch_extract import batch_extract
from utils.palette_generator import color_palette_generator
from utils.color_stats import color_statistics
from utils.swatch_exporter import export_html_swatches
from utils.color_preview import preview_colors
from utils.settings import settings_menu
# Initialize colorama
init(autoreset=True)
class ColorExtractorGUI:
def __init__(self):
self.extractor = CSSColorExtractor()
self.output_dir = "Extracted Colours"
self.ensure_output_dir()
def ensure_output_dir(self):
"""Create output directory if it doesn't exist"""
if not os.path.exists(self.output_dir):
os.makedirs(self.output_dir)
def run(self):
"""Main application loop"""
while True:
animated_title()
show_menu()
choice = input(f"{Fore.YELLOW}Select option (0-7): {Fore.WHITE}")
if choice == '0':
print(f"\n{Fore.GREEN}Thanks for using CSS Color Extractor!")
print(f"{Fore.CYAN}Follow ACT91 on GitHub: https://github.com/ACT91")
break
elif choice == '1':
extract_single_website(self.extractor, self.output_dir)
elif choice == '2':
batch_extract(self.extractor, self.output_dir)
elif choice == '3':
color_palette_generator(self.extractor, self.output_dir)
elif choice == '4':
color_statistics(self.extractor)
elif choice == '5':
export_html_swatches(self.extractor, self.output_dir)
elif choice == '6':
preview_colors(self.output_dir)
elif choice == '7':
settings_menu(self.extractor)
else:
print(f"{Fore.RED}X Invalid option!")
if __name__ == "__main__":
app = ColorExtractorGUI()
app.run()