Skip to content
Myr

Merge pull request #1801 from BALaka-18/strikethrough-support

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Added strikethrough support for style

authored by David Lord · committed by GitHub · parents 6f705dd, 3a10d82 · Browse files · 2 files+9 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−0 removed

  • other:+9 added−0 removed

2 files+9 added−0 removed

modified:src/click/termui.py+8 added
454 unmodified lines
455 dim=None,456 underline=None,457 blink=None,458 reverse=None,459 strikethrough=None,460 reset=True,461):462 """Styles a text with ANSI styles and returns the new string. By463 default the styling is self contained which means that at the end
47 unmodified lines
511 :param blink: if provided this will enable or disable blinking.512 :param reverse: if provided this will enable or disable inverse513 rendering (foreground becomes background and the514 other way round).515 :param strikethrough: if provided this will enable or disable516 striking through text.517 :param reset: by default a reset-all code is added at the end of the518 string which means that styles do not carry over. This519 can be disabled to compose styles.520
2 unmodified lines
523524 .. versionchanged:: 8.0525 Added support for 256 and RGB color codes.526527 .. versionchanged:: 8.0528 Added the ``strikethrough`` parameter.529530 .. versionchanged:: 7.0531 Added support for bright colors.532533 .. versionadded:: 2.0
24 unmodified lines
558 if blink is not None:559 bits.append(f"\033[{5 if blink else 25}m")560 if reverse is not None:561 bits.append(f"\033[{7 if reverse else 27}m")562 if strikethrough is not None:563 bits.append(f"\033[{9 if strikethrough else 29}m")564 bits.append(text)565 if reset:566 bits.append(_ansi_reset_all)567 return "".join(bits)
174 unmodified lines
modified:CHANGES.rst+1 added
170 unmodified lines
171- Option prompts validate the value with the option's callback in172 addition to its type. :issue:`457`173- ``confirmation_prompt`` can be set to a custom string. :issue:`723`174- Allow styled output in Jupyter on Windows. :issue:`1271`175- ``style()`` supports the ``strikethrough`` style. :issue:`805`176177178Version 7.1.2179-------------
635 unmodified lines