import os import sys # Default settings settings = { "user_color": "\033[96m", # Cyan "bot_color": "\033[93m", # Yellow "system_color": "\033[92m", # Green "error_color": "\033[91m", # Red "bg_color": "", # Default background "bot_name": "Bot", "user_name": "You" } # Color options (Numpad 1-9) COLORS = { "1": ("\033[91m", "Red"), "2": ("\033[92m", "Green"), "3": ("\033[93m", "Yellow"), "4": ("\033[94m", "Blue"), "5": ("\033[95m", "Magenta"), "6": ("\033[96m", "Cyan"), "7": ("\033[97m", "White"), "8": ("\033[90m", "Gray"), "9": ("\033[0m", "Default") } RESET = "\033[0m" def clear_screen(): os.system('cls' if os.name == 'nt' else 'clear') def print_colored(text, color): print(f"{color}{text}{RESET}") def show_color_menu(): print_colored("\n╔══════════════════════════════════════╗", settings["system_color"]) print_colored("║ COLOR SELECTION MENU ║", settings["system_color"]) print_colored("╠══════════════════════════════════════╣", settings["system_color"]) for num, (code, name) in COLORS.items(): print(f" {code}[{num}] {name}{RESET}") print_colored("╚══════════════════════════════════════╝", settings["system_color"]) def settings_menu(): while True: clear_screen() print_colored("\n╔══════════════════════════════════════╗", settings["system_color"]) print_colored("║ ⚙️ SETTINGS ⚙️ ║", settings["system_color"]) print_colored("╠══════════════════════════════════════╣", settings["system_color"]) print_colored("║ [1] Change User Text Color ║", settings["system_color"]) print_colored("║ [2] Change Bot Text Color ║", settings["system_color"]) print_colored("║ [3] Change System Color ║", settings["system_color"]) print_colored("║ [4] Change Bot Name ║", settings["system_color"]) print_colored("║ [5] Change Your Name ║", settings["system_color"]) print_colored("║ [6] Preview Colors ║", settings["system_color"]) print_colored("║ [0] Back to Chat ║", settings["system_color"]) print_colored("╚══════════════════════════════════════╝", settings["system_color"]) choice = input("\nSelect option: ").strip() if choice == "1": print_colored("\nSelect USER text color (Numpad 1-9):", settings["system_color"]) show_color_menu() color_choice = input("Enter number: ").strip() if color_choice in COLORS: settings["user_color"] = COLORS[color_choice][0] print_colored(f"✓ User color set to {COLORS[color_choice][1]}", settings["system_color"]) input("Press Enter to continue...") elif choice == "2": print_colored("\nSelect BOT text color (Numpad 1-9):", settings["system_color"]) show_color_menu() color_choice = input("Enter number: ").strip() if color_choice in COLORS: settings["bot_color"] = COLORS[color_choice][0] print_colored(f"✓ Bot color set to {COLORS[color_choice][1]}", settings["system_color"]) input("Press Enter to continue...") elif choice == "3": print_colored("\nSelect SYSTEM text color (Numpad 1-9):", settings["system_color"]) show_color_menu() color_choice = input("Enter number: ").strip() if color_choice in COLORS: settings["system_color"] = COLORS[color_choice][0] print_colored(f"✓ System color set to {COLORS[color_choice][1]}", settings["system_color"]) input("Press Enter to continue...") elif choice == "4": new_name = input("Enter new bot name: ").strip() if new_name: settings["bot_name"] = new_name print_colored(f"✓ Bot name set to '{new_name}'", settings["system_color"]) input("Press Enter to continue...") elif choice == "5": new_name = input("Enter your name: ").strip() if new_name: settings["user_name"] = new_name print_colored(f"✓ Your name set to '{new_name}'", settings["system_color"]) input("Press Enter to continue...") elif choice == "6": print_colored("\n--- COLOR PREVIEW ---", settings["system_color"]) print(f"{settings['user_color']}{settings['user_name']}: Hello, this is how your messages look!{RESET}") print(f"{settings['bot_color']}{settings['bot_name']}: And this is how my responses appear!{RESET}") print_colored("System: This is a system message.", settings["system_color"]) print_colored("Error: This is an error message.", settings["error_color"]) input("\nPress Enter to continue...") elif choice == "0": break def get_bot_response(user_input): # Add your chatbot logic here responses = { "hello": "Hey there! How can I help you?", "hi": "Hello! Nice to chat with you!", "how are you": "I'm doing great, thanks for asking!", "bye": "Goodbye! Have a great day!", "help": "Available commands:\n /settings - Customize colors and names\n /clear - Clear screen\n /quit - Exit chatbot" } lower_input = user_input.lower() for key, response in responses.items(): if key in lower_input: return response return "I'm not sure how to respond to that. Type 'help' for available commands!" def main(): clear_screen() print_colored("╔══════════════════════════════════════╗", settings["system_color"]) print_colored("║ 🤖 CUSTOMIZABLE CHATBOT 🤖 ║", settings["system_color"]) print_colored("║ Type /settings to customize me! ║", settings["system_color"]) print_colored("╚══════════════════════════════════════╝", settings["system_color"]) print() while True: try: user_input = input(f"{settings['user_color']}{settings['user_name']}: {RESET}").strip() if not user_input: continue # Command handling if user_input.lower() == "/settings": settings_menu() clear_screen() print_colored("Back to chat! Settings saved.", settings["system_color"]) continue elif user_input.lower() == "/clear": clear_screen() continue elif user_input.lower() in ["/quit", "/exit", "quit", "exit"]: print_colored(f"\n{settings['bot_name']}: Goodbye! 👋", settings["bot_color"]) break # Get and display bot response response = get_bot_response(user_input) print(f"{settings['bot_color']}{settings['bot_name']}: {response}{RESET}") print() except KeyboardInterrupt: print_colored(f"\n\n{settings['bot_name']}: Goodbye! 👋", settings["bot_color"]) break if __name__ == "__main__": main()