Adding colors, also renamed loader to game

This commit is contained in:
Matyáš Caras 2021-11-03 10:23:37 +01:00
parent 43aad028d7
commit b9f7abb29e
3 changed files with 12 additions and 2 deletions

View file

@ -1,7 +1,9 @@
from sys import argv
from loader import *
from game import *
from colorama import init
def main():
init()
if len(argv)<2:
print("You need to specify a path to a YAML file")
exit(1)

View file

@ -1,5 +1,6 @@
import yaml
from yaml.loader import SafeLoader
from colorama import Fore, Back, Style
class Game:
def __init__(self,name:str,author:str,game:dict):
@ -36,6 +37,12 @@ class Game:
isWrong = self.make_selection(sel)
self.printme()
def parse_colors(self,text:str) -> str:
'''
Used to convert color codes in string to colors from the colorama lib
'''
return text.replace("&b",Fore.CYAN)
def load(file_path):
'''Loads the game from a YAML file to a Game class'''

View file

@ -1 +1,2 @@
pyyaml==6.0
pyyaml==6.0
colorama==0.4.4