Skip to content

Instantly share code, notes, and snippets.

@AlexWaygood
Created April 10, 2024 14:54
Show Gist options
  • Save AlexWaygood/0526a59ef5e73724b63c414ede7a1417 to your computer and use it in GitHub Desktop.
Save AlexWaygood/0526a59ef5e73724b63c414ede7a1417 to your computer and use it in GitHub Desktop.
thing
from types import SimpleNamespace
AnsiColors = SimpleNamespace(
BOLD_GREEN="\x1b[1;32m",
BOLD_MAGENTA="\x1b[1;35m",
BOLD_RED="\x1b[1;31m",
GREEN="\x1b[32m",
GREY = "\x1b[90m"
MAGENTA = "\x1b[35m"
RED = "\x1b[31m"
RESET = "\x1b[0m"
YELLOW = "\x1b[33m"
)
def get_ansii_colors():
if can_colorise():
return AnsiColors
return SimpleNamespace(**dict.fromkeys(vars(AnsiColors), ""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment