18 lines
547 B
Python
18 lines
547 B
Python
# ansi code blocks for pretty text
|
|
|
|
|
|
class AnsiBlocks:
|
|
gray = "\u001b[0;30m{}\u001b[0;0m"
|
|
red = "\u001b[0;31m{}\u001b[0;0m"
|
|
green = "\u001b[0;32m{}\u001b[0;0m"
|
|
yellow = "\u001b[0;33m{}\u001b[0;0m"
|
|
blue = "\u001b[0;34m{}\u001b[0;0m"
|
|
pink = "\u001b[0;35m{}\u001b[0;0m"
|
|
cyan = "\u001b[0;36m{}\u001b[0;0m"
|
|
white = "\u001b[0;37m{}\u001b[0;0m"
|
|
|
|
def wrap(self, color: str, text: str, bold: bool = False):
|
|
if bold:
|
|
color.replace("[0", "[1")
|
|
return "```ansi\n" + color.format(text) + "\n```"
|