Files
2024-09-17 23:47:27 +02:00

89 lines
5.9 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import itertools
def print_format_table():
"""
prints table of formatted text format options
"""
# SGR arguments:
# n Name Note
# 0 Reset or normal All attributes become turned off
# 1 Bold or increased intensity As with faint, the color change is a PC (SCO / CGA) invention.[22][better source needed]
# 2 Faint, decreased intensity, or dim May be implemented as a light font weight like bold.[23]
# 3 Italic Not widely supported. Sometimes treated as inverse or blink.[22]
# 4 Underline Style extensions exist for Kitty, VTE, mintty, iTerm2 and Konsole.[24][25][26]
# 5 Slow blink Sets blinking to less than 150 times per minute
# 6 Rapid blink MS-DOS ANSI.SYS, 150+ per minute; not widely supported
# 7 Reverse video or invert Swap foreground and background colors; inconsistent emulation[27][dubious discuss]
# 8 Conceal or hide Not widely supported.
# 9 Crossed-out, or strike Characters legible but marked as if for deletion. Not supported in Terminal.app.
# 10 Primary (default) font
# 1119 Alternative font Select alternative font n 10
# 20 Fraktur (Gothic) Rarely supported
# 21 Doubly underlined; or: not bold Double-underline per ECMA-48,[5]:8.3.117 but instead disables bold intensity on several terminals, including in the Linux kernel's console before version 4.17.[28]
# 22 Normal intensity Neither bold nor faint; color changes where intensity is implemented as such.
# 23 Neither italic, nor blackletter
# 24 Not underlined Neither singly nor doubly underlined
# 25 Not blinking Turn blinking off
# 26 Proportional spacing ITU T.61 and T.416, not known to be used on terminals
# 27 Not reversed
# 28 Reveal Not concealed
# 29 Not crossed out
# 3037 Set foreground color
# 38 Set foreground color Next arguments are 5;n or 2;r;g;b
# 39 Default foreground color Implementation defined (according to standard)
# 4047 Set background color
# 48 Set background color Next arguments are 5;n or 2;r;g;b
# 49 Default background color Implementation defined (according to standard)
# 50 Disable proportional spacing T.61 and T.416
# 51 Framed Implemented as "emoji variation selector" in mintty.[29]
# 52 Encircled
# 53 Overlined Not supported in Terminal.app
# 54 Neither framed nor encircled
# 55 Not overlined
# 58 Set underline color Not in standard; implemented in Kitty, VTE, mintty, and iTerm2.[24][25] Next arguments are 5;n or 2;r;g;b.
# 59 Default underline color Not in standard; implemented in Kitty, VTE, mintty, and iTerm2.[24][25]
# 60 Ideogram underline or right side line Rarely supported
# 61 Ideogram double underline, or double line on the right side
# 62 Ideogram overline or left side line
# 63 Ideogram double overline, or double line on the left side
# 64 Ideogram stress marking
# 65 No ideogram attributes Reset the effects of all of 6064
# 73 Superscript Implemented only in mintty[29]
# 74 Subscript
# 75 Neither superscript nor subscript
# 9097 Set bright foreground color Not in standard; originally implemented by aixterm[13]
# 100107 Set bright background color
print(''.join(
f'\x1b[0;{command}m\\x1b[{command}m\x1b[m{' '*(3-len(str(command)))}{' ' if (command + 1) % 18 else '\n'}'
for command in range(108)
))
supported = (0, # reset
1, # bold
2, # dim
22, # normal intensity
3, # italic
23, # ? neither italic nor blackletter
53, # overlined
55, # not overlined
4, # underline
21, # dunderline
24, # ? not underlined
9, # strike
29, # not strike
7, # invert
27, # not inverted
8, # hidden
28, # not hidden
30, 31, 32, 33, 34, 35, 36, 37, # fg color
38, # fg color 38;5;n or 38;2;r;g;b
39, # reset fg color
40, 41, 42, 43, 44, 45, 46, 47, # bg color
48, # bg color 48;5;n or 48;2;r;g;b
49, # reset bg color
90, 91, 92, 93, 94, 95, 96, 97,
100, 101, 102, 103, 104, 105, 106, 107
)
print_format_table()