2018-11-13 16:02:26 +00:00
|
|
|
import typing
|
|
|
|
|
2018-10-30 14:58:48 +00:00
|
|
|
BITBOT_HOOKS_MAGIC = "__bitbot_hooks"
|
|
|
|
BITBOT_EXPORTS_MAGIC = "__bitbot_exports"
|
2018-11-13 16:02:26 +00:00
|
|
|
|
|
|
|
class IRCColor(object):
|
2018-11-13 17:23:18 +00:00
|
|
|
def __init__(self, irc: int, ansi: int, ansi_bold: bool):
|
2018-11-13 16:02:26 +00:00
|
|
|
self.irc = irc
|
|
|
|
self.ansi = ansi
|
2018-11-13 17:23:18 +00:00
|
|
|
self.ansi_bold = ansi_bold
|
2018-11-13 16:02:26 +00:00
|
|
|
|
2018-11-13 17:23:18 +00:00
|
|
|
COLOR_NAMES = {}
|
|
|
|
COLOR_CODES = {}
|
|
|
|
def _color(name: str, irc: int, ansi: int, ansi_bold: bool):
|
|
|
|
color = IRCColor(irc, ansi, ansi_bold)
|
|
|
|
COLOR_NAMES[name] = color
|
|
|
|
COLOR_CODES[irc] = color
|
|
|
|
return color
|
|
|
|
|
2018-11-13 17:43:00 +00:00
|
|
|
WHITE = _color("white", 0, 37, True)
|
|
|
|
BLACK = _color("black", 1, 30, False)
|
|
|
|
BLUE = _color("blue", 2, 34, False)
|
|
|
|
GREEN = _color("green", 3, 32, False)
|
|
|
|
RED = _color("red", 4, 31, True)
|
|
|
|
BROWN = _color("brown", 5, 31, False)
|
|
|
|
PURPLE = _color("purple", 6, 35, False)
|
|
|
|
ORANGE = _color("orange", 7, 33, False)
|
|
|
|
YELLOW = _color("yellow", 8, 33, True)
|
2018-11-13 17:23:18 +00:00
|
|
|
LIGHTGREEN = _color("light green", 9, 32, True)
|
2018-11-13 17:43:00 +00:00
|
|
|
CYAN = _color("cyan", 10, 36, False)
|
|
|
|
LIGHTCYAN = _color("light cyan", 11, 36, True)
|
|
|
|
LIGHTBLUE = _color("light blue", 12, 34, True)
|
|
|
|
PINK = _color("pink", 13, 35, True)
|
|
|
|
GREY = _color("grey", 14, 30, True)
|
|
|
|
LIGHTGREY = _color("light grey", 15, 37, False)
|
2018-11-13 16:02:26 +00:00
|
|
|
|
2018-11-13 17:43:00 +00:00
|
|
|
BOLD = "\x02"
|
|
|
|
ITALIC = "\x1D"
|
|
|
|
UNDERLINE = "\x1F"
|
|
|
|
INVERT = "\x16"
|
|
|
|
COLOR = "\x03"
|
|
|
|
RESET = "\x0F"
|
2018-11-13 16:02:26 +00:00
|
|
|
|
2018-11-13 17:43:00 +00:00
|
|
|
ANSI_FORMAT = "\033[%sm"
|
|
|
|
ANSI_RESET = "\033[0m"
|
2018-11-13 17:53:37 +00:00
|
|
|
ANSI_COLOR_RESET = "\033[39m"
|
2018-11-13 17:43:00 +00:00
|
|
|
ANSI_BOLD = "\033[1m"
|
2018-11-13 18:19:37 +00:00
|
|
|
ANSI_BOLD_RESET = "\033[22m"
|