mirror of
https://github.com/Textualize/rich.git
synced 2025-08-03 17:48:25 +00:00
box docs
This commit is contained in:
parent
79475b2e48
commit
ab178c2acc
5 changed files with 100 additions and 127 deletions
|
@ -8,120 +8,62 @@ Rich defines a number of ways of drawing boxes and lines such as those used in t
|
|||
from rich import box
|
||||
table = Table(box=box.SQUARE)
|
||||
|
||||
The constants are as follows:
|
||||
|
||||
|
||||
.. note::
|
||||
Some of the box drawing characters will not display correctly on Windows legacy terminal (cmd.exe) with *raster* fonts, and are disabled by default. If you want the full range of box options on Windows legacy terminal, use a *truetype* font and set the ``safe_box`` parameter on the Table class to ``False``.
|
||||
|
||||
|
||||
The following table is generated with the following command::
|
||||
|
||||
python -m rich.box
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #800080"> box.ASCII </span>
|
||||
+-------------------------+
|
||||
|<span style="color: #7f7f7f; font-weight: bold"> </span>|<span style="color: #7f7f7f; font-weight: bold"> </span>|
|
||||
|------------+------------|
|
||||
|<span style="color: #7f7f7f"> </span>|<span style="color: #7f7f7f"> </span>|
|
||||
|------------+------------|
|
||||
|<span style="color: #7f7f7f; font-weight: bold"> </span>|<span style="color: #7f7f7f; font-weight: bold"> </span>|
|
||||
+-------------------------+
|
||||
<span style="color: #800080"> box.SQUARE </span>
|
||||
┌────────────┬────────────┐
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>│
|
||||
├────────────┼────────────┤
|
||||
│<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>│
|
||||
├────────────┼────────────┤
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>│
|
||||
└────────────┴────────────┘
|
||||
<span style="color: #800080"> box.MINIMAL </span>
|
||||
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
────────────┼────────────
|
||||
<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>
|
||||
────────────┼────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
|
||||
<span style="color: #800080"> box.MINIMAL_HEAVY_HEAD </span>
|
||||
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
━━━━━━━━━━━━┿━━━━━━━━━━━━
|
||||
<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>
|
||||
────────────┼────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
|
||||
<span style="color: #800080"> box.MINIMAL_DOUBLE_HEAD </span>
|
||||
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
════════════╪════════════
|
||||
<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>
|
||||
────────────┼────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
|
||||
<span style="color: #800080"> box.SIMPLE </span>
|
||||
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
───────────────────────────
|
||||
<span style="color: #7f7f7f"> </span> <span style="color: #7f7f7f"> </span>
|
||||
───────────────────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
|
||||
<span style="color: #800080"> box.SIMPLE_HEAVY </span>
|
||||
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
╺━━━━━━━━━━━━━━━━━━━━━━━━━╸
|
||||
<span style="color: #7f7f7f"> </span> <span style="color: #7f7f7f"> </span>
|
||||
╺━━━━━━━━━━━━━━━━━━━━━━━━━╸
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
|
||||
<span style="color: #800080"> box.HORIZONTALS </span>
|
||||
───────────────────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
───────────────────────────
|
||||
<span style="color: #7f7f7f"> </span> <span style="color: #7f7f7f"> </span>
|
||||
───────────────────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> </span> <span style="color: #7f7f7f; font-weight: bold"> </span>
|
||||
───────────────────────────
|
||||
<span style="color: #800080"> box.ROUNDED </span>
|
||||
╭────────────┬────────────╮
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>│
|
||||
├────────────┼────────────┤
|
||||
│<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>│
|
||||
├────────────┼────────────┤
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>│
|
||||
╰────────────┴────────────╯
|
||||
<span style="color: #800080"> box.HEAVY </span>
|
||||
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┓
|
||||
┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃
|
||||
┣━━━━━━━━━━━━╋━━━━━━━━━━━━┫
|
||||
┃<span style="color: #7f7f7f"> </span>┃<span style="color: #7f7f7f"> </span>┃
|
||||
┣━━━━━━━━━━━━╋━━━━━━━━━━━━┫
|
||||
┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃
|
||||
┗━━━━━━━━━━━━┻━━━━━━━━━━━━┛
|
||||
<span style="color: #800080"> box.HEAVY_EDGE </span>
|
||||
┏━━━━━━━━━━━━┯━━━━━━━━━━━━┓
|
||||
┃<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>┃
|
||||
┠────────────┼────────────┨
|
||||
┃<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>┃
|
||||
┠────────────┼────────────┨
|
||||
┃<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>┃
|
||||
┗━━━━━━━━━━━━┷━━━━━━━━━━━━┛
|
||||
<span style="color: #800080"> box.HEAVY_HEAD </span>
|
||||
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┓
|
||||
┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃<span style="color: #7f7f7f; font-weight: bold"> </span>┃
|
||||
┡━━━━━━━━━━━━╇━━━━━━━━━━━━┩
|
||||
│<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>│
|
||||
├────────────┼────────────┤
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>│
|
||||
└────────────┴────────────┘
|
||||
<span style="color: #800080"> box.DOUBLE </span>
|
||||
╔════════════╦════════════╗
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> </span>║<span style="color: #7f7f7f; font-weight: bold"> </span>║
|
||||
╠════════════╬════════════╣
|
||||
║<span style="color: #7f7f7f"> </span>║<span style="color: #7f7f7f"> </span>║
|
||||
╠════════════╬════════════╣
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> </span>║<span style="color: #7f7f7f; font-weight: bold"> </span>║
|
||||
╚════════════╩════════════╝
|
||||
<span style="color: #800080"> box.DOUBLE_EDGE </span>
|
||||
╔════════════╤════════════╗
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>║
|
||||
╟────────────┼────────────╢
|
||||
║<span style="color: #7f7f7f"> </span>│<span style="color: #7f7f7f"> </span>║
|
||||
╟────────────┼────────────╢
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> </span>│<span style="color: #7f7f7f; font-weight: bold"> </span>║
|
||||
╚════════════╧════════════╝
|
||||
<pre style="font-size:90%;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><span style="color: #008000">╭────────────────────────────────────────────────────────────────────────────────────────────────╮</span>
|
||||
<span style="color: #008000">│</span> <span style="color: #008000; font-weight: bold">Box Constants</span> <span style="color: #008000">│
|
||||
╰────────────────────────────────────────────────────────────────────────────────────────────────╯</span>
|
||||
|
||||
<span style="color: #800080"> box.ASCII </span> <span style="color: #800080"> box.SQUARE </span> <span style="color: #800080"> box.MINIMAL </span> <span style="color: #800080">box.MINIMAL_HEAVY_HEAD </span>
|
||||
+---------------------+ ┌──────────┬──────────┐
|
||||
|<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>|<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>| │<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>│ <span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>
|
||||
|----------+----------| ├──────────┼──────────┤ ──────────┼────────── ━━━━━━━━━━┿━━━━━━━━━━
|
||||
|<span style="color: #7f7f7f"> Cell </span>|<span style="color: #7f7f7f"> Cell </span>| │<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│ <span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>
|
||||
|<span style="color: #7f7f7f"> Cell </span>|<span style="color: #7f7f7f"> Cell </span>| │<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│ <span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>
|
||||
|----------+----------| ├──────────┼──────────┤ ──────────┼────────── ──────────┼──────────
|
||||
|<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>|<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>| │<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>│ <span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>
|
||||
+---------------------+ └──────────┴──────────┘
|
||||
|
||||
|
||||
<span style="color: #800080">box.MINIMAL_DOUBLE_HEAD</span> <span style="color: #800080"> box.SIMPLE </span> <span style="color: #800080"> box.SIMPLE_HEAVY </span> <span style="color: #800080"> box.HORIZONTALS </span>
|
||||
───────────────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>
|
||||
══════════╪══════════ ─────────────────────── ╺━━━━━━━━━━━━━━━━━━━━━╸ ───────────────────────
|
||||
<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span>
|
||||
<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span> <span style="color: #7f7f7f"> Cell </span>
|
||||
──────────┼────────── ─────────────────────── ╺━━━━━━━━━━━━━━━━━━━━━╸ ───────────────────────
|
||||
<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span> <span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>
|
||||
───────────────────────
|
||||
|
||||
|
||||
<span style="color: #800080"> box.ROUNDED </span> <span style="color: #800080"> box.HEAVY </span> <span style="color: #800080"> box.HEAVY_EDGE </span> <span style="color: #800080"> box.HEAVY_HEAD </span>
|
||||
╭──────────┬──────────╮ ┏━━━━━━━━━━┳━━━━━━━━━━┓ ┏━━━━━━━━━━┯━━━━━━━━━━┓ ┏━━━━━━━━━━┳━━━━━━━━━━┓
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>│ ┃<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>┃<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>┃ ┃<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>┃ ┃<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>┃<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>┃
|
||||
├──────────┼──────────┤ ┣━━━━━━━━━━╋━━━━━━━━━━┫ ┠──────────┼──────────┨ ┡━━━━━━━━━━╇━━━━━━━━━━┩
|
||||
│<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│ ┃<span style="color: #7f7f7f"> Cell </span>┃<span style="color: #7f7f7f"> Cell </span>┃ ┃<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>┃ │<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│
|
||||
│<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│ ┃<span style="color: #7f7f7f"> Cell </span>┃<span style="color: #7f7f7f"> Cell </span>┃ ┃<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>┃ │<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>│
|
||||
├──────────┼──────────┤ ┣━━━━━━━━━━╋━━━━━━━━━━┫ ┠──────────┼──────────┨ ├──────────┼──────────┤
|
||||
│<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>│ ┃<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>┃<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>┃ ┃<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>┃ │<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>│
|
||||
╰──────────┴──────────╯ ┗━━━━━━━━━━┻━━━━━━━━━━┛ ┗━━━━━━━━━━┷━━━━━━━━━━┛ └──────────┴──────────┘
|
||||
|
||||
|
||||
<span style="color: #800080"> box.DOUBLE </span> <span style="color: #800080"> box.DOUBLE_EDGE </span>
|
||||
╔══════════╦══════════╗ ╔══════════╤══════════╗
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>║<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>║ ║<span style="color: #7f7f7f; font-weight: bold"> Header 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Header 2 </span>║
|
||||
╠══════════╬══════════╣ ╟──────────┼──────────╢
|
||||
║<span style="color: #7f7f7f"> Cell </span>║<span style="color: #7f7f7f"> Cell </span>║ ║<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>║
|
||||
║<span style="color: #7f7f7f"> Cell </span>║<span style="color: #7f7f7f"> Cell </span>║ ║<span style="color: #7f7f7f"> Cell </span>│<span style="color: #7f7f7f"> Cell </span>║
|
||||
╠══════════╬══════════╣ ╟──────────┼──────────╢
|
||||
║<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>║<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>║ ║<span style="color: #7f7f7f; font-weight: bold"> Footer 1 </span>│<span style="color: #7f7f7f; font-weight: bold"> Footer 2 </span>║
|
||||
╚══════════╩══════════╝ ╚══════════╧══════════╝
|
||||
</pre>
|
Loading…
Add table
Add a link
Reference in a new issue