From eabdb77797504296598f7699f8676994a2fc276a Mon Sep 17 00:00:00 2001 From: CSnap Date: Fri, 17 Nov 2023 00:54:35 +0000 Subject: [PATCH] And then I colorized it. --- LICENSE | 2 +- README.md | 5 ++++- f8ball.py | 11 +++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 3fb6769..7f863af 100644 --- a/LICENSE +++ b/LICENSE @@ -219,7 +219,7 @@ If you develop a new program, and you want it to be of the greatest possible use To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - PyF8-Ball + Pythonic Fate Ball Copyright (C) 2023 CSnap This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/README.md b/README.md index 02cd0b9..fa88447 100644 --- a/README.md +++ b/README.md @@ -3,5 +3,8 @@ Let python decide your fate via 8-Ball logic! Call the script with a question. Get an answer. +``` +./f8ball.py "Question?" +``` -Results may vary. No warranty or guarantee of any kind is implied. +*Results may vary. No warranty or guarantee of any kind is implied.* diff --git a/f8ball.py b/f8ball.py index 5070a87..8c8f779 100755 --- a/f8ball.py +++ b/f8ball.py @@ -1,8 +1,11 @@ #!/usr/bin/python +from colorama import Fore, Style, init import random import sys +init(autoreset=True) + def magic_fate_ball(): # Define possible responses responses = [ @@ -23,9 +26,13 @@ def magic_fate_ball(): "This is The Way." ] - # Display a random response + # Choose a random color for each response + response_colors = [Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.CYAN, Fore.MAGENTA, Fore.BLUE, Fore.WHITE] + + # Display a random response with a random color response = random.choice(responses) - print(f"The Pythonic Fate Ball says: {response}") + response_color = random.choice(response_colors) + print(f"The Pythonic Fate Ball says: {response_color}{response}{Style.RESET_ALL}") if __name__ == "__main__": magic_fate_ball()