-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1400e41
commit d2067c0
Showing
3 changed files
with
90 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import annotations | ||
from enum import Enum | ||
|
||
import colorama | ||
|
||
|
||
colorama.init() | ||
|
||
|
||
class Color(Enum): | ||
white = colorama.Fore.WHITE | ||
yellow = colorama.Fore.YELLOW | ||
red = colorama.Fore.RED | ||
green = colorama.Fore.GREEN | ||
cyan = colorama.Fore.CYAN | ||
|
||
|
||
def format_text(message: str, color: Color = Color.white, bold=False) -> str: | ||
return ( | ||
(colorama.Style.BRIGHT if bold else "") | ||
+ color.value | ||
+ message | ||
+ colorama.Fore.RESET | ||
+ colorama.Style.RESET_ALL | ||
) | ||
|
||
|
||
def fixed_width(text: str, min_length: int = 10) -> str: | ||
length = len(text) | ||
if length < min_length: | ||
return text + "".join([" " for _ in range(min_length - length)]) | ||
else: | ||
return text | ||
|
||
|
||
def get_underline(length: int, character: str = "=") -> str: | ||
return "".join([character for i in range(length)]) |