diff --git a/assets/src/ba_data/python/efro/terminal.py b/assets/src/ba_data/python/efro/terminal.py index 13605da5..727331f3 100644 --- a/assets/src/ba_data/python/efro/terminal.py +++ b/assets/src/ba_data/python/efro/terminal.py @@ -32,7 +32,11 @@ if TYPE_CHECKING: @unique class TerminalColor(Enum): - """Color codes for printing to terminals.""" + """Color codes for printing to terminals. + + Generally the Clr class should be used when incorporating color into + terminal output, as it handles non-color-supporting terminals/etc. + """ # Styles RESET = '\033[0m' diff --git a/tools/snippets b/tools/snippets index 1973470e..0f32c34f 100755 --- a/tools/snippets +++ b/tools/snippets @@ -614,5 +614,16 @@ def filter_server_config() -> None: batools.build.filter_server_config(sys.argv[2], sys.argv[3]) +def printcolors() -> None: + """Print all colors available in efro.terminals.TerminalColor.""" + from efro.terminal import TerminalColor + for value in TerminalColor: + if value is TerminalColor.RESET: + continue + print(f'{value.name}: {value.value}' + f'The quick brown fox jumps over the lazy dog.' + f'{TerminalColor.RESET.value}') + + if __name__ == '__main__': snippets_main(globals())