Files
overcode/commands/cmd_theme.py

44 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""
Theme Command - Change shell appearance
"""
from colorama import Fore, Style, init
init(autoreset=True)
class ThemeCommand:
"""Change shell theme"""
def __init__(self, theme_manager, theme_name):
self.theme_manager = theme_manager
self.theme_name = theme_name.strip().lower()
def run(self):
"""Execute the theme command"""
if not self.theme_name:
self._show_themes()
return
if self.theme_manager.set_theme(self.theme_name):
c = self.theme_manager.colors
print(c['primary'] + f"✓ Theme changed to: {self.theme_name}")
print(c['secondary'] + "Theme will be applied immediately!")
else:
print(Fore.RED + f"❌ Theme '{self.theme_name}' not found!")
self._show_themes()
def _show_themes(self):
"""Show available themes"""
print(Fore.CYAN + "🎨 Available Themes:")
print(Fore.YELLOW + "" * 30)
for theme_name, colors in self.theme_manager.themes.items():
primary = colors['primary']
accent = colors['accent']
current = " (current)" if theme_name == self.theme_manager.current_theme else ""
print(f"{primary}{accent}{Fore.WHITE} {theme_name}{current}")
print(f"\n{Fore.WHITE}Usage: theme <theme_name>")
print(f"{Fore.LIGHTBLACK_EX}Example: theme cyberpunk")