pytermor


Namepytermor JSON
Version 1.8.0 PyPI version JSON
download
home_pagehttps://github.com/delameter/pytermor
SummaryANSI formatted terminal output library
upload_time2022-05-20 03:04:37
maintainer
docs_urlNone
authorAleksandr Shavykin
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
  <img src="https://user-images.githubusercontent.com/50381946/167745623-66bcb825-f787-4f8a-a317-18775d3f104a.png">
  <br>
  <code>
    pytermor
  </code>
  <br>
</h1>

_(yet another)_ Python library designed for formatting terminal output using ANSI escape codes. Implements automatic "soft" format termination. Provides a registry of ready-to-use SGR sequences and formats (=combined sequences).

## Motivation

Key feature of this library is providing necessary abstractions for building complex text sections with lots of formatting, while keeping the application code clear and readable.

## Installation

    pip install pytermor



## Use cases

_Format_ is a combination of two control sequences; it wraps specified string with pre-defined leading and trailing SGR definitions.

```python3
from pytermor import fmt

print(fmt.blue('Use'), fmt.cyan('cases'))
```

<details>
<summary><b>Examples</b> <i>(click)</i></summary>

## * ![image](https://user-images.githubusercontent.com/50381946/161387692-4374edcb-c1fe-438f-96f1-dae3c5ad4088.png)

Preset formats can safely overlap with each other (as long as they require different **breaker** sequences to reset).

```python3
from pytermor import fmt

print(fmt.blue(fmt.underlined('Nested') + fmt.bold(' formats')))
```

## * ![image](https://user-images.githubusercontent.com/50381946/161387711-23746520-419b-4917-9401-257854ff2d8a.png)

Compose text formats with automatic content-aware format termination.

```python3
from pytermor import autof

fmt1 = autof('hi_cyan', 'bold')
fmt2 = autof('bg_black', 'inversed', 'underlined', 'italic')

msg = fmt1(f'Content{fmt2("-aware format")} nesting')
print(msg)
```

## * ![image](https://user-images.githubusercontent.com/50381946/161387734-677d5b10-15c1-4926-933f-b1144b0ce5cb.png)

Create your own _SGR_ _sequences_ with `build()` method, which accepts color/attribute keys, integer codes and even existing _SGRs_, in any amount and in any order. Key resolving is case-insensitive.

```python3
from pytermor import seq, build

seq1 = build('red', 1)  # keys or integer codes
seq2 = build(seq1, seq.ITALIC)  # existing SGRs as part of a new one
seq3 = build('underlined', 'YELLOW')  # case-insensitive

msg = f'{seq1}Flexible{seq.RESET} ' + \
      f'{seq2}sequence{seq.RESET} ' + \
      str(seq3) + 'builder' + str(seq.RESET)
print(msg)
```

## * ![image](https://user-images.githubusercontent.com/50381946/161387746-0a94e3d2-8295-478c-828c-333e99e5d50a.png)

Use `build_c256()` to set foreground/background color to any of [↗ xterm-256 colors](https://www.ditig.com/256-colors-cheat-sheet).

```python3
from pytermor import build_c256, seq, autof

txt = '256 colors support'
start_color = 41
msg = ''
for idx, c in enumerate(range(start_color, start_color+(36*6), 36)):
    msg += f'{build_c256(c)}{txt[idx*3:(idx+1)*3]}{seq.COLOR_OFF}'

print(autof(seq.BOLD).wrap(msg))
```

## * ![image](https://user-images.githubusercontent.com/50381946/161411577-743b9a81-eac3-47c0-9b59-82b289cc0f45.png)

It's also possible to use 16M-color mode (or True color) &mdash; with `build_rgb()` wrapper method.

```python3
from pytermor import build_rgb, seq, fmt

txt = 'True color support'
msg = ''
for idx, c in enumerate(range(0, 256, 256//18)):
    r = max(0, 255-c)
    g = max(0, min(255, 127-(c*2)))
    b = c
    msg += f'{build_rgb(r, g, b)}{txt[idx:(idx+1)]}{seq.COLOR_OFF}'

print(fmt.bold(msg))
```

</details>


## Format soft reset

There are two ways to manage color and attribute termination:

- hard reset (SGR 0 | `\e[0m`)
- soft reset (SGR 22, 23, 24 etc.)

The main difference between them is that **hard** reset disables all formatting after itself, while **soft** reset disables only actually necessary attributes (i.e. used as opening sequence in _Format_ instance's context) and keeps the other.

That's what _Format_ class and `autof` method are designed for: to simplify creation of soft-resetting text spans, so that developer doesn't have to restore all previously applied formats after every closing sequence.

Example: we are given a text span which is initially **bold** and <u>underlined</u>. We want to recolor a few words inside of this span. By default this will result in losing all the formatting to the right of updated text span (because `RESET`|`\e[0m` clears all text attributes).

However, there is an option to specify what attributes should be disabled or let the library do that for you:

```python3
from pytermor import seq, fmt, autof, Format

# automatically:
fmt_warn = autof(seq.HI_YELLOW + seq.UNDERLINED)
# or manually:
fmt_warn = Format(
    seq.HI_YELLOW + seq.UNDERLINED,  # sequences can be summed up, remember?
    seq.COLOR_OFF + seq.UNDERLINED_OFF,  # "counteractive" sequences
    hard_reset_after=False
)

orig_text = fmt.bold(f'this is {seq.BG_GRAY}the original{seq.RESET} string')
updated_text = orig_text.replace('original', fmt_warn('updated'), 1)
print(orig_text, '\n', updated_text)
```
> ![image](https://user-images.githubusercontent.com/50381946/163714299-1f7d3d52-0b9a-4d3e-91bf-26e8cce9b1f1.png)

As you can see, the update went well &mdash; we kept all the previously applied formatting. Of course, this method cannot be 100% applicable &mdash; for example, imagine that original text was colored blue. After the update "string" word won't be blue anymore, as we used `COLOR_OFF` escape sequence to neutralize our own yellow color. But it still can be helpful for a majority of cases (especially when text is generated and formatted by the same program and in one go).


## API: pytermor

### &gt; `autof`

Signature: `autof(*params str|int|SequenceSGR) -> Format`

Create new _Format_ with specified control sequence(s) as a opening/starter sequence and **automatically compose** closing sequence that will terminate attributes defined in opening sequence while keeping the others (soft reset).

Resulting sequence params' order is the same as argument's order.

Each sequence param can be specified as:
- string key (see [API: Registries](#api-registries))
- integer param value
- existing _SequenceSGR_ instance (params will be extracted)

### &gt; `build`

Signature: `build(*params str|int|SequenceSGR) -> SequenceSGR`

Create new _SequenceSGR_ with specified params. Resulting sequence params order is the same as argument order. Parameter specification is the same as for `autof`.

_SequenceSGR_ with zero params was specifically implemented to translate into empty string and not into `\e[m`, which wolud make sense, but also would be very entangling, as it's equivavlent of `\e[0m` &mdash; **hard reset** sequence.

### &gt; `build_c256`

Signature:`build_c256(color: int, bg: bool = False) -> SequenceSGR`

Create new _SequenceSGR_ that sets foreground color or background color, depending on `bg` value, in 256-color mode. Valid values for `color` are [0; 255], see more at [↗ xterm-256 colors](https://www.ditig.com/256-colors-cheat-sheet) page.

### &gt; `build_rgb`

Signature:`build_rgb(r: int, g: int, b: int, bg: bool = False) -> SequenceSGR`

Create new _SequenceSGR_ that sets foreground color or background color, depending on `bg` value, in 16M-color mode. Valid values for `r`, `g` and `b` are [0; 255]; this range is linearly translated into [0x00; 0xFF] for each channel; the result value is composed as #RRGGBB.


## API: SGR sequences

Class representing SGR-type ANSI escape sequence with varying amount of parameters.

<details>
<summary><b>Details</b> <i>(click)</i></summary>

### Creating the sequence

You can use any of predefined sequences from `pytermor.seq` or create your own via standard constructor (see below). Valid argument values as well as preset constants are described in [API: Registries](#api-registries) section.

### Applying the sequence

To get the resulting sequence chars use `print()` method or cast instance to _str_:

```python3
from pytermor import SequenceSGR

seq = SequenceSGR(4, 7)
msg = f'({seq})'
print(msg + f'{SequenceSGR(0).print()}', str(msg.encode()), msg.encode().hex(':'))
```
> ![image](https://user-images.githubusercontent.com/50381946/161387861-5203fff8-86c8-4c52-8518-63a5525c09f7.png)

1st part is "applied" escape sequence; 2nd part shows up a sequence in raw mode, as if it was ignored by the terminal; 3rd part is hexademical sequence byte values.

<details>
<summary><b>SGR sequence structure</b> <i>(click)</i></summary>

1. `\x1b`|`1b` is ESC **control character**, which opens a control sequence.

2. `[` is sequence **introducer**, it determines the type of control sequence (in this case it's _CSI_, or "Control Sequence Introducer").

3. `4` and `7` are **parameters** of the escape sequence; they mean "underlined" and "inversed" attributes respectively. Those parameters must be separated by `;`.

4. `m` is sequence **terminator**; it also determines the sub-type of sequence, in our case _SGR_, or "Select Graphic Rendition". Sequences of this kind are most commonly encountered.

</details>

### Combining SGRs

One instance of _SequenceSGR_ can be added to another. This will result in a new _SequenceSGR_ with combined params.

```python3
from pytermor import seq, SequenceSGR

combined = SequenceSGR(1, 31) + SequenceSGR(4)
print(f'{combined}combined{seq.RESET}', str(combined).encode())
```
> ![image](https://user-images.githubusercontent.com/50381946/161387867-808831e5-784b-49ec-9c24-490734ef4eab.png)

</details>

## API: Formats

_Format_ is a wrapper class that contains starting (i.e. opening) _SequenceSGR_ and (optionally) closing _SequenceSGR_.

<details>
<summary><b>Details</b> <i>(click)</i></summary>

### Creating the format

You can define your own reusable <i>Format</i>s (see below) or import predefined ones from `pytermor.fmt` (see [API: Registries](#api-registries) section).

### Applying the format

Use `wrap()` method of _Format_ instance or call the instance itself to enclose specified string in starting/terminating SGR sequences:

```python3
from pytermor import seq, fmt, Format

fmt_error = Format(seq.BG_HI_RED + seq.UNDERLINED, seq.BG_COLOR_OFF + seq.UNDERLINED_OFF)
msg = fmt.italic.wrap('italic might ' + fmt_error('not') + ' work')
print(msg)
```
> ![image](https://user-images.githubusercontent.com/50381946/161387874-5c25a493-253b-4f9e-8dbf-8328add2e5d5.png)

</details>


## API: strf.StringFilter

_StringFilter_ is common string modifier interface with dynamic configuration support.

<details>
<summary><b>Details</b> <i>(click)</i></summary>

### Implementations

- ReplaceSGR
- ReplaceCSI
- ReplaceNonAsciiBytes

### Standalone usage

Can be applied using `.apply()` method or with direct call.

```python3
from pytermor import fmt, ReplaceSGR

formatted = fmt.red('this text is red')
replaced = ReplaceSGR('[LIE]').apply(formatted)
# replaced = ReplaceSequenceSGRs('[LIE]')(formatted)

print(formatted, '\n', replaced)
```
> ![image](https://user-images.githubusercontent.com/50381946/161387885-0fc0fcb5-09aa-4258-aa25-312220e7f994.png)


### Usage with helper

Helper function `apply_filters` accepts both `StringFilter` instances and types, but latter is not configurable and will be invoked using default settings.

```python3
from pytermor import apply_filters, ReplaceNonAsciiBytes

ascii_and_binary = b'\xc0\xff\xeeQWE\xffRT\xeb\x00\xc0\xcd\xed'
result = apply_filters(ascii_and_binary, ReplaceNonAsciiBytes)
print(ascii_and_binary, '\n', result)
```
> ![image](https://user-images.githubusercontent.com/50381946/161387889-a1920f13-f5fc-4d10-b535-93f1a1b1aa5c.png)

</details>


## API: strf.fmtd

Set of methods to make working with SGR sequences a bit easier.

- `ljust_fmtd()`   SGR-formatting-aware implementation of str.ljust()
- `rjust_fmtd()`  same, but for _str.rjust()_
- `center_fmtd()` same, but for _str.center()_


## API: numf.*

`pytermor` also includes a few helper formatters for numbers.

<details>
<summary><b>Details</b> <i>(click)</i></summary>

### &gt; `format_auto_float`

Dynamically adjust decimal digit amount to fill the output string up with significant digits as much as possible. Universal solution for situations when you don't know exaclty what values will be displayed, but have fixed output width. Invocation: `format_auto_float(value, 4)`.

| value       |  result    |
| ----------: | ---------- |
| **1&nbsp;234.56** |  `"1235"`  |
| **123.56**  |  `" 124"`  |
| **12.56**   |  `"12.6"`  |
| **1.56**    |  `"1.56"`  |
                               

### &gt; `format_prefixed_unit`

Similar to previous method, but this one also supports metric prefixes and is highly customizable. Invocation: `format_prefixed_unit(value)`.

| value  | **631**   | **1&nbsp;080**    | **45&nbsp;200**    | **1&nbsp;257&nbsp;800** |  4,31×10⁷ | 7,00×10⁸ | 2,50×10⁹ | 
| :------: | :--------: | :--------: | :--------: | :--------: |  :--------: | :--------: | :--------: | 
| result | <code>631&nbsp;b</code> | <code>1.05&nbsp;kb</code> | <code>44.14&nbsp;kb</code> | <code>1.20&nbsp;Mb</code> |  <code>41.11&nbsp;Mb</code> | <code>668.0&nbsp;Mb</code>  | <code>2.33&nbsp;Gb</code>    |

Settings:
```python
PrefixedUnitPreset(
    max_value_len=5, integer_input=True,
    unit='b', unit_separator=' ',
    mcoef=1024.0,
    prefixes=[None, 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'],
    prefix_zero_idx=0,
)
```

Example #2 illustrating small numbers: 

| value  | **-1.2345×10⁻¹¹**   | **1.2345×10⁻⁸**    |  **1.2345×10⁻⁴** | **0.01234** | **1.23456** | **123.456** | **−12 345** |
| :------: | :--------: | :--------: |  :---: | :---: | :---: | :---: | :---: |
| result | <code>-0.012nm</code> | <code>0.0123μm</code> | <code>0.1235mm</code> | <code>0.0123m</code> | <code>1.2346m</code> | <code>123.46m</code> | <code>-12.35km</code>

```python
PrefixedUnitPreset(
    max_value_len=6, integer_input=False,
    unit='m', unit_separator='',
    mcoef=1000.0,
    prefixes=['y', 'z', 'a', 'f', 'p', 'n', 'μ', 'm', None],
    prefix_zero_idx=8,
)
```

### &gt; `format_time_delta`

Formats time interval in 4 different variants - 3-char, 4-char, 6-char and 10-char width output. Usage: `format_time_delta(seconds, max_len)`.

| width   | 2 | 10 | 60 | 2700 | 32&nbsp;340 | 273&nbsp;600 | 4&nbsp;752&nbsp;000 | 8,64×10⁸ |
| ------:  | --- | --- | --- | --- | --- | --- | --- | --- |
| **3&nbsp;chars**  | <code>2s</code>| <code>10s</code>| <code>1m</code>| <code>45m</code>| <code>8h</code>| <code>3d</code>| <code>55d</code>| -- |
| **4&nbsp;chars**  | <code>2&nbsp;s </code>| <code>10&nbsp;s </code>| <code>1&nbsp;m </code>| <code>45&nbsp;m </code>| <code>8&nbsp;h </code>| <code>3&nbsp;d </code>| <code>1&nbsp;M </code>| <code>27&nbsp;y </code>|                  
| **6&nbsp;chars**  | <code>2&nbsp;sec </code>| <code>10&nbsp;sec </code>| <code>1&nbsp;min </code>| <code>45&nbsp;min</code>| <code>8h&nbsp;59m </code>| <code>3d&nbsp;4h </code>| <code>1&nbsp;mon </code>| <code>27&nbsp;yr </code>|
| **10&nbsp;chars** | <code>2&nbsp;secs </code>| <code>10&nbsp;secs </code>| <code>1&nbsp;min</code> | <code>45&nbsp;mins</code>| <code>8h&nbsp;59m </code>| <code>3d&nbsp;4h </code>| <code>1&nbsp;months </code>| <code>27&nbsp;years </code>|

Settings example (for 10-char mode):
```python
TimeDeltaPreset([
    TimeUnit('sec', 60), 
    TimeUnit('min', 60, custom_short='min'), 
    TimeUnit('hour', 24, collapsible_after=24),
    TimeUnit('day', 30, collapsible_after=10),
    TimeUnit('month', 12),
    TimeUnit('year', overflow_afer=999),
], allow_negative=True,
    unit_separator=' ',
    plural_suffix='s',
    overflow_msg='OVERFLOW',
),
```

</details>

## API: Registries

<details>
<summary><b>Sequences</b> <i>(click)</i></summary>


- **code** &mdash; SGR integer code(s) for specified sequence (order is important)
- **name** &mdash; variable name; usage: `from pytermor.seq import RESET`
- **key** &mdash; string that will be recognised by `build()`|`autof()` etc.
- **description** &mdash; effect of applying the sequence / additional notes

As a rule of a thumb, **key** equals to **name** in lower case.

<table>
  <tr>
    <th>code</th>
    <th>name</th>
    <th>key</th>
    <th>description</th>
  </tr>
  <tr>
    <td align=center>0</td>
    <td><code>RESET</code></td>
    <td><code>reset</code></td>
    <td>Reset all attributes and colors</td>
  </tr>

  <tr><td colspan="4"><br><b>attributes</b></td></tr>
  <tr>
    <td align=center>1</td>
    <td><code>BOLD</code></td>
    <td><code>bold</code></td>
    <td>Bold or increased intensity</td>
  </tr>
  <tr>
    <td align=center>2</td>
    <td><code>DIM</code></td>
    <td><code>dim</code></td>
    <td>Faint, decreased intensity</td>
  </tr>
  <tr>
    <td align=center>3</td>
    <td><code>ITALIC</code></td>
    <td><code>italic</code></td>
    <td>Italic; not widely supported</td>
  </tr>
  <tr>
    <td align=center>4</td>
    <td><code>UNDERLINED</code></td>
    <td><code>underlined</code></td>
    <td>Underline</td>
  </tr>
  <tr>
    <td align=center>5</td>
    <td><code>BLINK_SLOW</code></td>
    <td><code>blink_slow</code></td>
    <td>Sets blinking to &lt; 150 cpm</td>
  </tr>
  <tr>
    <td align=center>6</td>
    <td><code>BLINK_FAST</code></td>
    <td><code>blink_fast</code></td>
    <td>150+ cpm; not widely supported</td>
  </tr>
  <tr>
    <td align=center>7</td>
    <td><code>INVERSED</code></td>
    <td><code>inversed</code></td>
    <td>Swap foreground and background colors</td>
  </tr>
  <tr>
    <td align=center>8</td>
    <td><code>HIDDEN</code></td>
    <td><code>hidden</code></td>
    <td>Conceal characters; not widely supported</td>
  </tr>
  <tr>
    <td align=center>9</td>
    <td><code>CROSSLINED</code></td>
    <td><code>crosslined</code></td>
    <td>Strikethrough</td>
  </tr>
  <tr>
    <td align=center>21</td>
    <td><code>DOUBLE_UNDERLINED</code></td>
    <td><code>double_underlined</code></td>
    <td>Double-underline; on several terminals disables <code>BOLD</code> instead</td>
  </tr>
  <tr>
    <td align=center>53</td>
    <td><code>OVERLINED</code></td>
    <td><code>overlined</code></td>
    <td>Not widely supported</td>
  </tr>

  <tr><td colspan="4"><br><b>breakers</b></td></tr>
  <tr>
    <td align=center>22</td>
    <td><code>BOLD_DIM_OFF</code></td>
    <td><code>bold_dim_off</code></td>
    <td>Disable <code>BOLD</code> and <code>DIM</code> attributes. <i>Special aspects... It's impossible to reliably disable them on a separate basis.</i></td>
  </tr>
  <tr>
    <td align=center>23</td>
    <td><code>ITALIC_OFF</code></td>
    <td><code>italic_off</code></td>
    <td>Disable italic</td>
  </tr>
  <tr>
    <td align=center>24</td>
    <td><code>UNDERLINED_OFF</code></td>
    <td><code>underlined_off</code></td>
    <td>Disable underlining</td>
  </tr>
  <tr>
    <td align=center>25</td>
    <td><code>BLINK_OFF</code></td>
    <td><code>blink_off</code></td>
    <td>Disable blinking</td>
  </tr>
  <tr>
    <td align=center>27</td>
    <td><code>INVERSED_OFF</code></td>
    <td><code>inversed_off</code></td>
    <td>Disable inversing</td>
  </tr>
  <tr>
    <td align=center>28</td>
    <td><code>HIDDEN_OFF</code></td>
    <td><code>hidden_off</code></td>
    <td>Disable conecaling</td>
  </tr>
  <tr>
    <td align=center>29</td>
    <td><code>CROSSLINED_OFF</code></td>
    <td><code>crosslined_off</code></td>
    <td>Disable strikethrough</td>
  </tr>
  <tr>
    <td align=center>39</td>
    <td><code>COLOR_OFF</code></td>
    <td><code>color_off</code></td>
    <td>Reset foreground color</td>
  </tr>
  <tr>
    <td align=center>49</td>
    <td><code>BG_COLOR_OFF</code></td>
    <td><code>bg_color_off</code></td>
    <td>Reset bg color</td>
  </tr>
  <tr>
    <td align=center>55</td>
    <td><code>OVERLINED_OFF</code></td>
    <td><code>overlined_off</code></td>
    <td>Disable overlining</td>
  </tr>

  <tr><td colspan="4"><br><b>[foreground] colors</b></td></tr>
  <tr>
    <td align=center>30</td>
    <td><code>BLACK</code></td>
    <td><code>black</code></td>
    <td>Set foreground color to black</td>
  </tr>
  <tr>
    <td align=center>31</td>
    <td><code>RED</code></td>
    <td><code>red</code></td>
    <td>Set foreground color to red</td>
  </tr>
  <tr>
    <td align=center>32</td>
    <td><code>GREEN</code></td>
    <td><code>green</code></td>
    <td>Set foreground color to green</td>
  </tr>
  <tr>
    <td align=center>33</td>
    <td><code>YELLOW</code></td>
    <td><code>yellow</code></td>
    <td>Set foreground color to yellow</td>
  </tr>
  <tr>
    <td align=center>34</td>
    <td><code>BLUE</code></td>
    <td><code>blue</code></td>
    <td>Set foreground color to blue</td>
  </tr>
  <tr>
    <td align=center>35</td>
    <td><code>MAGENTA</code></td>
    <td><code>magenta</code></td>
    <td>Set foreground color to magneta</td>
  </tr>
  <tr>
    <td align=center>36</td>
    <td><code>CYAN</code></td>
    <td><code>cyan</code></td>
    <td>Set foreground color to cyan</td>
  </tr>
  <tr>
    <td align=center>37</td>
    <td><code>WHITE</code></td>
    <td><code>white</code></td>
    <td>Set foreground color to white</td>
  </tr>
  <tr>
    <td align=center><s>38;5</s></td>
    <td colspan="2" align="center">
        Use <code>color_c256()</code> instead
    </td>
    <td>Set foreground color [256 mode]</td>
  </tr>
  <tr>
    <td align=center><s>38;2</s></td>
    <td colspan="2" align="center">
        Use <code>color_rgb()</code> instead
    </td>
    <td>Set foreground color [16M mode]</td>
  </tr>

  <tr><td colspan="4"><br><b>background colors</b></td></tr>
  <tr>
    <td align=center>40</td>
    <td><code>BG_BLACK</code></td>
    <td><code>bg_black</code></td>
    <td>Set background color to black</td>
  </tr>
  <tr>
    <td align=center>41</td>
    <td><code>BG_RED</code></td>
    <td><code>bg_red</code></td>
    <td>Set background color to red</td>
  </tr>
  <tr>
    <td align=center>42</td>
    <td><code>BG_GREEN</code></td>
    <td><code>bg_green</code></td>
    <td>Set background color to green</td>
  </tr>
  <tr>
    <td align=center>43</td>
    <td><code>BG_YELLOW</code></td>
    <td><code>bg_yellow</code></td>
    <td>Set background color to yellow</td>
  </tr>
  <tr>
    <td align=center>44</td>
    <td><code>BG_BLUE</code></td>
    <td><code>bg_blue</code></td>
    <td>Set background color to blue</td>
  </tr>
  <tr>
    <td align=center>45</td>
    <td><code>BG_MAGENTA</code></td>
    <td><code>bg_magenta</code></td>
    <td>Set background color to magenta</td>
  </tr>
  <tr>
    <td align=center>46</td>
    <td><code>BG_CYAN</code></td>
    <td><code>bg_cyan</code></td>
    <td>Set background color to cyan</td>
  </tr>
  <tr>
    <td align=center>47</td>
    <td><code>BG_WHITE</code></td>
    <td><code>bg_white</code></td>
    <td>Set background color to white</td>
  </tr>
  <tr>
    <td align=center><s>48;5</s></td>
    <td colspan="2" align="center">
        Use <code>color_c256()</code> instead
    </td>
    <td>Set background color [256 mode]</td>
  </tr>
  <tr>
    <td align=center><s>48;2</s></td>
    <td colspan="2" align="center">
        Use <code>color_rgb()</code> instead
    </td>
    <td>Set background color [16M mode]</td>
  </tr>

  <tr><td colspan="4"><br><b>high-intensity [foreground] colors</b></td></tr>
  <tr>
    <td align=center>90</td>
    <td><code>GRAY</code></td>
    <td><code>gray</code></td>
    <td>Set foreground color to bright black/gray</td>
  </tr>
  <tr>
    <td align=center>91</td>
    <td><code>HI_RED</code></td>
    <td><code>hi_red</code></td>
    <td>Set foreground color to bright red</td>
  </tr>
  <tr>
    <td align=center>92</td>
    <td><code>HI_GREEN</code></td>
    <td><code>hi_green</code></td>
    <td>Set foreground color to bright green</td>
  </tr>
  <tr>
    <td align=center>93</td>
    <td><code>HI_YELLOW</code></td>
    <td><code>hi_yellow</code></td>
    <td>Set foreground color to bright yellow</td>
  </tr>
  <tr>
    <td align=center>94</td>
    <td><code>HI_BLUE</code></td>
    <td><code>hi_blue</code></td>
    <td>Set foreground color to bright blue</td>
  </tr>
  <tr>
    <td align=center>95</td>
    <td><code>HI_MAGENTA</code></td>
    <td><code>hi_magenta</code></td>
    <td>Set foreground color to bright magenta</td>
  </tr>
  <tr>
    <td align=center>96</td>
    <td><code>HI_CYAN</code></td>
    <td><code>hi_cyan</code></td>
    <td>Set foreground color to bright cyan</td>
  </tr>
  <tr>
    <td align=center>97</td>
    <td><code>HI_WHITE</code></td>
    <td><code>hi_white</code></td>
    <td>Set foreground color to bright white</td>
  </tr>

  <tr><td colspan="4"><br><b>high-intensity background colors</b></td></tr>
  <tr>
    <td align=center>100</td>
    <td><code>BG_GRAY</code></td>
    <td><code>bg_gray</code></td>
    <td>Set background color to bright black/gray</td>
  </tr>
  <tr>
    <td align=center>101</td>
    <td><code>BG_HI_RED</code></td>
    <td><code>bg_hi_red</code></td>
    <td>Set background color to bright red</td>
  </tr>
  <tr>
    <td align=center>102</td>
    <td><code>BG_HI_GREEN</code></td>
    <td><code>bg_hi_green</code></td>
    <td>Set background color to bright green</td>
  </tr>
  <tr>
    <td align=center>103</td>
    <td><code>BG_HI_YELLOW</code></td>
    <td><code>bg_hi_yellow</code></td>
    <td>Set background color to bright yellow</td>
  </tr>
  <tr>
    <td align=center>104</td>
    <td><code>BG_HI_BLUE</code></td>
    <td><code>bg_hi_blue</code></td>
    <td>Set background color to bright blue</td>
  </tr>
  <tr>
    <td align=center>105</td>
    <td><code>BG_HI_MAGENTA</code></td>
    <td><code>bg_hi_magenta</code></td>
    <td>Set background color to bright magenta</td>
  </tr>
  <tr>
    <td align=center>106</td>
    <td><code>BG_HI_CYAN</code></td>
    <td><code>bg_hi_cyan</code></td>
    <td>Set background color to bright cyan</td>
  </tr>
  <tr>
    <td align=center>107</td>
    <td><code>BG_HI_WHITE</code></td>
    <td><code>bg_hi_white</code></td>
    <td>Set background color to bright white</td>
  </tr>
</table>

</details>

<details>
<summary><b>Formats</b> <i>(click)</i></summary>

- **name** &mdash; variable name; usage: `from pytermor.fmt import bold`
- **opening seq**, **closing seq** &mdash; corresponding <i>SGR</i>s

As a rule of a thumb, **name** equals to **opening seq** in lower case.

<table>
  <tr>
    <th>name</th>
    <th>opening seq</th>
    <th>closing seq</th>
  </tr>
  <tr><td colspan="3"><br><b>attributes</b></td></tr>
  <tr>
    <td><code>bold</code></td>
    <td><code>BOLD</code></td>
    <td><code>BOLD_DIM_OFF</code></td>
  </tr>
  <tr>
    <td><code>dim</code></td>
    <td><code>DIM</code></td>
    <td><code>BOLD_DIM_OFF</code></td>
  </tr>
  <tr>
    <td><code>italic</code></td>
    <td><code>ITALIC</code></td>
    <td><code>ITALIC_OFF</code></td>
  </tr>
  <tr>
    <td><code>underlined</code></td>
    <td><code>UNDERLINED</code></td>
    <td><code>UNDERLINED_OFF</code></td>
  </tr>
  <tr>
    <td><code>inversed</code></td>
    <td><code>INVERSED</code></td>
    <td><code>INVERSED_OFF</code></td>
  </tr>
  <tr>
    <td><code>overlined</code></td>
    <td><code>OVERLINED</code></td>
    <td><code>OVERLINED_OFF</code></td>
  </tr>

  <tr><td colspan="3"><br><b>[foreground] colors</b></td></tr>
  <tr>
    <td><code>red</code></td>
    <td><code>RED</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>green</code></td>
    <td><code>GREEN</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>yellow</code></td>
    <td><code>YELLOW</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>blue</code></td>
    <td><code>BLUE</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>magenta</code></td>
    <td><code>MAGENTA</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>cyan</code></td>
    <td><code>CYAN</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>gray</code></td>
    <td><code>GRAY</code></td>
    <td><code>COLOR_OFF</code></td>
  </tr>

  <tr><td colspan="3"><br><b>background colors</b></td></tr>
  <tr>
    <td><code>bg_black</code></td>
    <td><code>BG_BLACK</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_red</code></td>
    <td><code>BG_RED</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_green</code></td>
    <td><code>BG_GREEN</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_yellow</code></td>
    <td><code>BG_YELLOW</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_blue</code></td>
    <td><code>BG_BLUE</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_magenta</code></td>
    <td><code>BG_MAGENTA</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_cyan</code></td>
    <td><code>BG_CYAN</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
  <tr>
    <td><code>bg_gray</code></td>
    <td><code>BG_GRAY</code></td>
    <td><code>BG_COLOR_OFF</code></td>
  </tr>
</table>

</details>

You can of course create your own sequences and formats, but with one limitation &mdash; autoformatting will not work with custom defined sequences; unless you add the corresponding rule to `pytermor.registry.sgr_parity_registry`.

## Changelog

### v1.8.0

- `format_prefixed_unit` extended for working with decimal and binary metric prefixes;
- `format_time_delta` extended with new settings;
- Value rounding transferred from  `format_auto_float` to `format_prefixed_unit`;
- Utility classes reorganization;
- Unit tests output formatting;
- `noop` SGR sequence and `noop` format;
- Max decimal points for `auto_float` extended from (2) to (max-2).
- 
### v1.7.4

- Added 3 formatters: `fmt_prefixed_unit`, `fmt_time_delta`, `fmt_auto_float`.

### v1.7.3

- Added `bg_black` format.

### v1.7.2

- Added `ljust_fmtd`, `rjust_fmtd`, `center_fmtd` util functions to align strings with SGRs correctly.

### v1.7.1

- Print reset sequence as `\e[m` instead of `\e[0m`.

### v1.7.0

- `Format()` constructor can be called without arguments.
- Added SGR code lists.

### v1.6.2

- Excluded `tests` dir from distribution package.

### v1.6.1

- Ridded of _EmptyFormat_ and _AbstractFormat_ classes.
- Renamed `code` module to `sgr` because of conflicts in PyCharm debugger (`pydevd_console_integration.py`).

### v1.5.0

- Removed excessive _EmptySequenceSGR_ &mdash; default _SGR_ class without params was specifically implemented to print out as empty string instead of `\e[m`.

### v1.4.0

- `Format.wrap()` now accepts any type of argument, not only _str_.
- Rebuilt _Sequence_ inheritance tree.
- Added equality methods for _Sequence_ and _Format_ classes/subclasses.
- Added some tests for `fmt.*` and `seq.*` classes.

### v1.3.2

- Added `gray` and `bg_gray` format presets. 

### v1.3.1

- Interface revisioning.

### v1.2.1

- `opening_seq` and `closing_seq` properties for _Format_ class.

### v1.2.0

- _EmptySequenceSGR_ and _EmptyFormat_ classes.

### v1.1.0

- Autoformat feature.

### v1.0.0

- First public version.

## References

- https://en.wikipedia.org/wiki/ANSI_escape_code
- [ANSI Escape Sequences](https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/delameter/pytermor",
    "name": "pytermor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Aleksandr Shavykin",
    "author_email": "0.delameter@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5b/06/f1838ae9ae7245eb910555420054fbb01fca9c8c2e7d5db7653f26a0d603/pytermor-1.8.0.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n  <img src=\"https://user-images.githubusercontent.com/50381946/167745623-66bcb825-f787-4f8a-a317-18775d3f104a.png\">\n  <br>\n  <code>\n    pytermor\n  </code>\n  <br>\n</h1>\n\n_(yet another)_ Python library designed for formatting terminal output using ANSI escape codes. Implements automatic \"soft\" format termination. Provides a registry of ready-to-use SGR sequences and formats (=combined sequences).\n\n## Motivation\n\nKey feature of this library is providing necessary abstractions for building complex text sections with lots of formatting, while keeping the application code clear and readable.\n\n## Installation\n\n    pip install pytermor\n\n\n\n## Use cases\n\n_Format_ is a combination of two control sequences; it wraps specified string with pre-defined leading and trailing SGR definitions.\n\n```python3\nfrom pytermor import fmt\n\nprint(fmt.blue('Use'), fmt.cyan('cases'))\n```\n\n<details>\n<summary><b>Examples</b> <i>(click)</i></summary>\n\n## * ![image](https://user-images.githubusercontent.com/50381946/161387692-4374edcb-c1fe-438f-96f1-dae3c5ad4088.png)\n\nPreset formats can safely overlap with each other (as long as they require different **breaker** sequences to reset).\n\n```python3\nfrom pytermor import fmt\n\nprint(fmt.blue(fmt.underlined('Nested') + fmt.bold(' formats')))\n```\n\n## * ![image](https://user-images.githubusercontent.com/50381946/161387711-23746520-419b-4917-9401-257854ff2d8a.png)\n\nCompose text formats with automatic content-aware format termination.\n\n```python3\nfrom pytermor import autof\n\nfmt1 = autof('hi_cyan', 'bold')\nfmt2 = autof('bg_black', 'inversed', 'underlined', 'italic')\n\nmsg = fmt1(f'Content{fmt2(\"-aware format\")} nesting')\nprint(msg)\n```\n\n## * ![image](https://user-images.githubusercontent.com/50381946/161387734-677d5b10-15c1-4926-933f-b1144b0ce5cb.png)\n\nCreate your own _SGR_ _sequences_ with `build()` method, which accepts color/attribute keys, integer codes and even existing _SGRs_, in any amount and in any order. Key resolving is case-insensitive.\n\n```python3\nfrom pytermor import seq, build\n\nseq1 = build('red', 1)  # keys or integer codes\nseq2 = build(seq1, seq.ITALIC)  # existing SGRs as part of a new one\nseq3 = build('underlined', 'YELLOW')  # case-insensitive\n\nmsg = f'{seq1}Flexible{seq.RESET} ' + \\\n      f'{seq2}sequence{seq.RESET} ' + \\\n      str(seq3) + 'builder' + str(seq.RESET)\nprint(msg)\n```\n\n## * ![image](https://user-images.githubusercontent.com/50381946/161387746-0a94e3d2-8295-478c-828c-333e99e5d50a.png)\n\nUse `build_c256()` to set foreground/background color to any of [\u2197 xterm-256 colors](https://www.ditig.com/256-colors-cheat-sheet).\n\n```python3\nfrom pytermor import build_c256, seq, autof\n\ntxt = '256 colors support'\nstart_color = 41\nmsg = ''\nfor idx, c in enumerate(range(start_color, start_color+(36*6), 36)):\n    msg += f'{build_c256(c)}{txt[idx*3:(idx+1)*3]}{seq.COLOR_OFF}'\n\nprint(autof(seq.BOLD).wrap(msg))\n```\n\n## * ![image](https://user-images.githubusercontent.com/50381946/161411577-743b9a81-eac3-47c0-9b59-82b289cc0f45.png)\n\nIt's also possible to use 16M-color mode (or True color) &mdash; with `build_rgb()` wrapper method.\n\n```python3\nfrom pytermor import build_rgb, seq, fmt\n\ntxt = 'True color support'\nmsg = ''\nfor idx, c in enumerate(range(0, 256, 256//18)):\n    r = max(0, 255-c)\n    g = max(0, min(255, 127-(c*2)))\n    b = c\n    msg += f'{build_rgb(r, g, b)}{txt[idx:(idx+1)]}{seq.COLOR_OFF}'\n\nprint(fmt.bold(msg))\n```\n\n</details>\n\n\n## Format soft reset\n\nThere are two ways to manage color and attribute termination:\n\n- hard reset (SGR 0 | `\\e[0m`)\n- soft reset (SGR 22, 23, 24 etc.)\n\nThe main difference between them is that **hard** reset disables all formatting after itself, while **soft** reset disables only actually necessary attributes (i.e. used as opening sequence in _Format_ instance's context) and keeps the other.\n\nThat's what _Format_ class and `autof` method are designed for: to simplify creation of soft-resetting text spans, so that developer doesn't have to restore all previously applied formats after every closing sequence.\n\nExample: we are given a text span which is initially **bold** and <u>underlined</u>. We want to recolor a few words inside of this span. By default this will result in losing all the formatting to the right of updated text span (because `RESET`|`\\e[0m` clears all text attributes).\n\nHowever, there is an option to specify what attributes should be disabled or let the library do that for you:\n\n```python3\nfrom pytermor import seq, fmt, autof, Format\n\n# automatically:\nfmt_warn = autof(seq.HI_YELLOW + seq.UNDERLINED)\n# or manually:\nfmt_warn = Format(\n    seq.HI_YELLOW + seq.UNDERLINED,  # sequences can be summed up, remember?\n    seq.COLOR_OFF + seq.UNDERLINED_OFF,  # \"counteractive\" sequences\n    hard_reset_after=False\n)\n\norig_text = fmt.bold(f'this is {seq.BG_GRAY}the original{seq.RESET} string')\nupdated_text = orig_text.replace('original', fmt_warn('updated'), 1)\nprint(orig_text, '\\n', updated_text)\n```\n> ![image](https://user-images.githubusercontent.com/50381946/163714299-1f7d3d52-0b9a-4d3e-91bf-26e8cce9b1f1.png)\n\nAs you can see, the update went well &mdash; we kept all the previously applied formatting. Of course, this method cannot be 100% applicable &mdash; for example, imagine that original text was colored blue. After the update \"string\" word won't be blue anymore, as we used `COLOR_OFF` escape sequence to neutralize our own yellow color. But it still can be helpful for a majority of cases (especially when text is generated and formatted by the same program and in one go).\n\n\n## API: pytermor\n\n### &gt; `autof`\n\nSignature: `autof(*params str|int|SequenceSGR) -> Format`\n\nCreate new _Format_ with specified control sequence(s) as a opening/starter sequence and **automatically compose** closing sequence that will terminate attributes defined in opening sequence while keeping the others (soft reset).\n\nResulting sequence params' order is the same as argument's order.\n\nEach sequence param can be specified as:\n- string key (see [API: Registries](#api-registries))\n- integer param value\n- existing _SequenceSGR_ instance (params will be extracted)\n\n### &gt; `build`\n\nSignature: `build(*params str|int|SequenceSGR) -> SequenceSGR`\n\nCreate new _SequenceSGR_ with specified params. Resulting sequence params order is the same as argument order. Parameter specification is the same as for `autof`.\n\n_SequenceSGR_ with zero params was specifically implemented to translate into empty string and not into `\\e[m`, which wolud make sense, but also would be very entangling, as it's equivavlent of `\\e[0m` &mdash; **hard reset** sequence.\n\n### &gt; `build_c256`\n\nSignature:`build_c256(color: int, bg: bool = False) -> SequenceSGR`\n\nCreate new _SequenceSGR_ that sets foreground color or background color, depending on `bg` value, in 256-color mode. Valid values for `color` are [0; 255], see more at [\u2197 xterm-256 colors](https://www.ditig.com/256-colors-cheat-sheet) page.\n\n### &gt; `build_rgb`\n\nSignature:`build_rgb(r: int, g: int, b: int, bg: bool = False) -> SequenceSGR`\n\nCreate new _SequenceSGR_ that sets foreground color or background color, depending on `bg` value, in 16M-color mode. Valid values for `r`, `g` and `b` are [0; 255]; this range is linearly translated into [0x00; 0xFF] for each channel; the result value is composed as #RRGGBB.\n\n\n## API: SGR sequences\n\nClass representing SGR-type ANSI escape sequence with varying amount of parameters.\n\n<details>\n<summary><b>Details</b> <i>(click)</i></summary>\n\n### Creating the sequence\n\nYou can use any of predefined sequences from `pytermor.seq` or create your own via standard constructor (see below). Valid argument values as well as preset constants are described in [API: Registries](#api-registries) section.\n\n### Applying the sequence\n\nTo get the resulting sequence chars use `print()` method or cast instance to _str_:\n\n```python3\nfrom pytermor import SequenceSGR\n\nseq = SequenceSGR(4, 7)\nmsg = f'({seq})'\nprint(msg + f'{SequenceSGR(0).print()}', str(msg.encode()), msg.encode().hex(':'))\n```\n> ![image](https://user-images.githubusercontent.com/50381946/161387861-5203fff8-86c8-4c52-8518-63a5525c09f7.png)\n\n1st part is \"applied\" escape sequence; 2nd part shows up a sequence in raw mode, as if it was ignored by the terminal; 3rd part is hexademical sequence byte values.\n\n<details>\n<summary><b>SGR sequence structure</b> <i>(click)</i></summary>\n\n1. `\\x1b`|`1b` is ESC **control character**, which opens a control sequence.\n\n2. `[` is sequence **introducer**, it determines the type of control sequence (in this case it's _CSI_, or \"Control Sequence Introducer\").\n\n3. `4` and `7` are **parameters** of the escape sequence; they mean \"underlined\" and \"inversed\" attributes respectively. Those parameters must be separated by `;`.\n\n4. `m` is sequence **terminator**; it also determines the sub-type of sequence, in our case _SGR_, or \"Select Graphic Rendition\". Sequences of this kind are most commonly encountered.\n\n</details>\n\n### Combining SGRs\n\nOne instance of _SequenceSGR_ can be added to another. This will result in a new _SequenceSGR_ with combined params.\n\n```python3\nfrom pytermor import seq, SequenceSGR\n\ncombined = SequenceSGR(1, 31) + SequenceSGR(4)\nprint(f'{combined}combined{seq.RESET}', str(combined).encode())\n```\n> ![image](https://user-images.githubusercontent.com/50381946/161387867-808831e5-784b-49ec-9c24-490734ef4eab.png)\n\n</details>\n\n## API: Formats\n\n_Format_ is a wrapper class that contains starting (i.e. opening) _SequenceSGR_ and (optionally) closing _SequenceSGR_.\n\n<details>\n<summary><b>Details</b> <i>(click)</i></summary>\n\n### Creating the format\n\nYou can define your own reusable <i>Format</i>s (see below) or import predefined ones from `pytermor.fmt` (see [API: Registries](#api-registries) section).\n\n### Applying the format\n\nUse `wrap()` method of _Format_ instance or call the instance itself to enclose specified string in starting/terminating SGR sequences:\n\n```python3\nfrom pytermor import seq, fmt, Format\n\nfmt_error = Format(seq.BG_HI_RED + seq.UNDERLINED, seq.BG_COLOR_OFF + seq.UNDERLINED_OFF)\nmsg = fmt.italic.wrap('italic might ' + fmt_error('not') + ' work')\nprint(msg)\n```\n> ![image](https://user-images.githubusercontent.com/50381946/161387874-5c25a493-253b-4f9e-8dbf-8328add2e5d5.png)\n\n</details>\n\n\n## API: strf.StringFilter\n\n_StringFilter_ is common string modifier interface with dynamic configuration support.\n\n<details>\n<summary><b>Details</b> <i>(click)</i></summary>\n\n### Implementations\n\n- ReplaceSGR\n- ReplaceCSI\n- ReplaceNonAsciiBytes\n\n### Standalone usage\n\nCan be applied using `.apply()` method or with direct call.\n\n```python3\nfrom pytermor import fmt, ReplaceSGR\n\nformatted = fmt.red('this text is red')\nreplaced = ReplaceSGR('[LIE]').apply(formatted)\n# replaced = ReplaceSequenceSGRs('[LIE]')(formatted)\n\nprint(formatted, '\\n', replaced)\n```\n> ![image](https://user-images.githubusercontent.com/50381946/161387885-0fc0fcb5-09aa-4258-aa25-312220e7f994.png)\n\n\n### Usage with helper\n\nHelper function `apply_filters` accepts both `StringFilter` instances and types, but latter is not configurable and will be invoked using default settings.\n\n```python3\nfrom pytermor import apply_filters, ReplaceNonAsciiBytes\n\nascii_and_binary = b'\\xc0\\xff\\xeeQWE\\xffRT\\xeb\\x00\\xc0\\xcd\\xed'\nresult = apply_filters(ascii_and_binary, ReplaceNonAsciiBytes)\nprint(ascii_and_binary, '\\n', result)\n```\n> ![image](https://user-images.githubusercontent.com/50381946/161387889-a1920f13-f5fc-4d10-b535-93f1a1b1aa5c.png)\n\n</details>\n\n\n## API: strf.fmtd\n\nSet of methods to make working with SGR sequences a bit easier.\n\n- `ljust_fmtd()`   SGR-formatting-aware implementation of str.ljust()\n- `rjust_fmtd()`  same, but for _str.rjust()_\n- `center_fmtd()` same, but for _str.center()_\n\n\n## API: numf.*\n\n`pytermor` also includes a few helper formatters for numbers.\n\n<details>\n<summary><b>Details</b> <i>(click)</i></summary>\n\n### &gt; `format_auto_float`\n\nDynamically adjust decimal digit amount to fill the output string up with significant digits as much as possible. Universal solution for situations when you don't know exaclty what values will be displayed, but have fixed output width. Invocation: `format_auto_float(value, 4)`.\n\n| value       |  result    |\n| ----------: | ---------- |\n| **1&nbsp;234.56** |  `\"1235\"`  |\n| **123.56**  |  `\" 124\"`  |\n| **12.56**   |  `\"12.6\"`  |\n| **1.56**    |  `\"1.56\"`  |\n                               \n\n### &gt; `format_prefixed_unit`\n\nSimilar to previous method, but this one also supports metric prefixes and is highly customizable. Invocation: `format_prefixed_unit(value)`.\n\n| value  | **631**   | **1&nbsp;080**    | **45&nbsp;200**    | **1&nbsp;257&nbsp;800** |  4,31\u00d710\u2077 | 7,00\u00d710\u2078 | 2,50\u00d710\u2079 | \n| :------: | :--------: | :--------: | :--------: | :--------: |  :--------: | :--------: | :--------: | \n| result | <code>631&nbsp;b</code> | <code>1.05&nbsp;kb</code> | <code>44.14&nbsp;kb</code> | <code>1.20&nbsp;Mb</code> |  <code>41.11&nbsp;Mb</code> | <code>668.0&nbsp;Mb</code>  | <code>2.33&nbsp;Gb</code>    |\n\nSettings:\n```python\nPrefixedUnitPreset(\n    max_value_len=5, integer_input=True,\n    unit='b', unit_separator=' ',\n    mcoef=1024.0,\n    prefixes=[None, 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'],\n    prefix_zero_idx=0,\n)\n```\n\nExample #2 illustrating small numbers: \n\n| value  | **-1.2345\u00d710\u207b\u00b9\u00b9**   | **1.2345\u00d710\u207b\u2078**    |  **1.2345\u00d710\u207b\u2074** | **0.01234** | **1.23456** | **123.456** | **\u221212 345** |\n| :------: | :--------: | :--------: |  :---: | :---: | :---: | :---: | :---: |\n| result | <code>-0.012nm</code> | <code>0.0123\u03bcm</code> | <code>0.1235mm</code> | <code>0.0123m</code> | <code>1.2346m</code> | <code>123.46m</code> | <code>-12.35km</code>\n\n```python\nPrefixedUnitPreset(\n    max_value_len=6, integer_input=False,\n    unit='m', unit_separator='',\n    mcoef=1000.0,\n    prefixes=['y', 'z', 'a', 'f', 'p', 'n', '\u03bc', 'm', None],\n    prefix_zero_idx=8,\n)\n```\n\n### &gt; `format_time_delta`\n\nFormats time interval in 4 different variants - 3-char, 4-char, 6-char and 10-char width output. Usage: `format_time_delta(seconds, max_len)`.\n\n| width   | 2 | 10 | 60 | 2700 | 32&nbsp;340 | 273&nbsp;600 | 4&nbsp;752&nbsp;000 | 8,64\u00d710\u2078 |\n| ------:  | --- | --- | --- | --- | --- | --- | --- | --- |\n| **3&nbsp;chars**  | <code>2s</code>| <code>10s</code>| <code>1m</code>| <code>45m</code>| <code>8h</code>| <code>3d</code>| <code>55d</code>| -- |\n| **4&nbsp;chars**  | <code>2&nbsp;s </code>| <code>10&nbsp;s </code>| <code>1&nbsp;m </code>| <code>45&nbsp;m </code>| <code>8&nbsp;h </code>| <code>3&nbsp;d </code>| <code>1&nbsp;M </code>| <code>27&nbsp;y </code>|                  \n| **6&nbsp;chars**  | <code>2&nbsp;sec </code>| <code>10&nbsp;sec </code>| <code>1&nbsp;min </code>| <code>45&nbsp;min</code>| <code>8h&nbsp;59m </code>| <code>3d&nbsp;4h </code>| <code>1&nbsp;mon </code>| <code>27&nbsp;yr </code>|\n| **10&nbsp;chars** | <code>2&nbsp;secs </code>| <code>10&nbsp;secs </code>| <code>1&nbsp;min</code> | <code>45&nbsp;mins</code>| <code>8h&nbsp;59m </code>| <code>3d&nbsp;4h </code>| <code>1&nbsp;months </code>| <code>27&nbsp;years </code>|\n\nSettings example (for 10-char mode):\n```python\nTimeDeltaPreset([\n    TimeUnit('sec', 60), \n    TimeUnit('min', 60, custom_short='min'), \n    TimeUnit('hour', 24, collapsible_after=24),\n    TimeUnit('day', 30, collapsible_after=10),\n    TimeUnit('month', 12),\n    TimeUnit('year', overflow_afer=999),\n], allow_negative=True,\n    unit_separator=' ',\n    plural_suffix='s',\n    overflow_msg='OVERFLOW',\n),\n```\n\n</details>\n\n## API: Registries\n\n<details>\n<summary><b>Sequences</b> <i>(click)</i></summary>\n\n\n- **code** &mdash; SGR integer code(s) for specified sequence (order is important)\n- **name** &mdash; variable name; usage: `from pytermor.seq import RESET`\n- **key** &mdash; string that will be recognised by `build()`|`autof()` etc.\n- **description** &mdash; effect of applying the sequence / additional notes\n\nAs a rule of a thumb, **key** equals to **name** in lower case.\n\n<table>\n  <tr>\n    <th>code</th>\n    <th>name</th>\n    <th>key</th>\n    <th>description</th>\n  </tr>\n  <tr>\n    <td align=center>0</td>\n    <td><code>RESET</code></td>\n    <td><code>reset</code></td>\n    <td>Reset all attributes and colors</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>attributes</b></td></tr>\n  <tr>\n    <td align=center>1</td>\n    <td><code>BOLD</code></td>\n    <td><code>bold</code></td>\n    <td>Bold or increased intensity</td>\n  </tr>\n  <tr>\n    <td align=center>2</td>\n    <td><code>DIM</code></td>\n    <td><code>dim</code></td>\n    <td>Faint, decreased intensity</td>\n  </tr>\n  <tr>\n    <td align=center>3</td>\n    <td><code>ITALIC</code></td>\n    <td><code>italic</code></td>\n    <td>Italic; not widely supported</td>\n  </tr>\n  <tr>\n    <td align=center>4</td>\n    <td><code>UNDERLINED</code></td>\n    <td><code>underlined</code></td>\n    <td>Underline</td>\n  </tr>\n  <tr>\n    <td align=center>5</td>\n    <td><code>BLINK_SLOW</code></td>\n    <td><code>blink_slow</code></td>\n    <td>Sets blinking to &lt; 150 cpm</td>\n  </tr>\n  <tr>\n    <td align=center>6</td>\n    <td><code>BLINK_FAST</code></td>\n    <td><code>blink_fast</code></td>\n    <td>150+ cpm; not widely supported</td>\n  </tr>\n  <tr>\n    <td align=center>7</td>\n    <td><code>INVERSED</code></td>\n    <td><code>inversed</code></td>\n    <td>Swap foreground and background colors</td>\n  </tr>\n  <tr>\n    <td align=center>8</td>\n    <td><code>HIDDEN</code></td>\n    <td><code>hidden</code></td>\n    <td>Conceal characters; not widely supported</td>\n  </tr>\n  <tr>\n    <td align=center>9</td>\n    <td><code>CROSSLINED</code></td>\n    <td><code>crosslined</code></td>\n    <td>Strikethrough</td>\n  </tr>\n  <tr>\n    <td align=center>21</td>\n    <td><code>DOUBLE_UNDERLINED</code></td>\n    <td><code>double_underlined</code></td>\n    <td>Double-underline; on several terminals disables <code>BOLD</code> instead</td>\n  </tr>\n  <tr>\n    <td align=center>53</td>\n    <td><code>OVERLINED</code></td>\n    <td><code>overlined</code></td>\n    <td>Not widely supported</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>breakers</b></td></tr>\n  <tr>\n    <td align=center>22</td>\n    <td><code>BOLD_DIM_OFF</code></td>\n    <td><code>bold_dim_off</code></td>\n    <td>Disable <code>BOLD</code> and <code>DIM</code> attributes. <i>Special aspects... It's impossible to reliably disable them on a separate basis.</i></td>\n  </tr>\n  <tr>\n    <td align=center>23</td>\n    <td><code>ITALIC_OFF</code></td>\n    <td><code>italic_off</code></td>\n    <td>Disable italic</td>\n  </tr>\n  <tr>\n    <td align=center>24</td>\n    <td><code>UNDERLINED_OFF</code></td>\n    <td><code>underlined_off</code></td>\n    <td>Disable underlining</td>\n  </tr>\n  <tr>\n    <td align=center>25</td>\n    <td><code>BLINK_OFF</code></td>\n    <td><code>blink_off</code></td>\n    <td>Disable blinking</td>\n  </tr>\n  <tr>\n    <td align=center>27</td>\n    <td><code>INVERSED_OFF</code></td>\n    <td><code>inversed_off</code></td>\n    <td>Disable inversing</td>\n  </tr>\n  <tr>\n    <td align=center>28</td>\n    <td><code>HIDDEN_OFF</code></td>\n    <td><code>hidden_off</code></td>\n    <td>Disable conecaling</td>\n  </tr>\n  <tr>\n    <td align=center>29</td>\n    <td><code>CROSSLINED_OFF</code></td>\n    <td><code>crosslined_off</code></td>\n    <td>Disable strikethrough</td>\n  </tr>\n  <tr>\n    <td align=center>39</td>\n    <td><code>COLOR_OFF</code></td>\n    <td><code>color_off</code></td>\n    <td>Reset foreground color</td>\n  </tr>\n  <tr>\n    <td align=center>49</td>\n    <td><code>BG_COLOR_OFF</code></td>\n    <td><code>bg_color_off</code></td>\n    <td>Reset bg color</td>\n  </tr>\n  <tr>\n    <td align=center>55</td>\n    <td><code>OVERLINED_OFF</code></td>\n    <td><code>overlined_off</code></td>\n    <td>Disable overlining</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>[foreground] colors</b></td></tr>\n  <tr>\n    <td align=center>30</td>\n    <td><code>BLACK</code></td>\n    <td><code>black</code></td>\n    <td>Set foreground color to black</td>\n  </tr>\n  <tr>\n    <td align=center>31</td>\n    <td><code>RED</code></td>\n    <td><code>red</code></td>\n    <td>Set foreground color to red</td>\n  </tr>\n  <tr>\n    <td align=center>32</td>\n    <td><code>GREEN</code></td>\n    <td><code>green</code></td>\n    <td>Set foreground color to green</td>\n  </tr>\n  <tr>\n    <td align=center>33</td>\n    <td><code>YELLOW</code></td>\n    <td><code>yellow</code></td>\n    <td>Set foreground color to yellow</td>\n  </tr>\n  <tr>\n    <td align=center>34</td>\n    <td><code>BLUE</code></td>\n    <td><code>blue</code></td>\n    <td>Set foreground color to blue</td>\n  </tr>\n  <tr>\n    <td align=center>35</td>\n    <td><code>MAGENTA</code></td>\n    <td><code>magenta</code></td>\n    <td>Set foreground color to magneta</td>\n  </tr>\n  <tr>\n    <td align=center>36</td>\n    <td><code>CYAN</code></td>\n    <td><code>cyan</code></td>\n    <td>Set foreground color to cyan</td>\n  </tr>\n  <tr>\n    <td align=center>37</td>\n    <td><code>WHITE</code></td>\n    <td><code>white</code></td>\n    <td>Set foreground color to white</td>\n  </tr>\n  <tr>\n    <td align=center><s>38;5</s></td>\n    <td colspan=\"2\" align=\"center\">\n        Use <code>color_c256()</code> instead\n    </td>\n    <td>Set foreground color [256 mode]</td>\n  </tr>\n  <tr>\n    <td align=center><s>38;2</s></td>\n    <td colspan=\"2\" align=\"center\">\n        Use <code>color_rgb()</code> instead\n    </td>\n    <td>Set foreground color [16M mode]</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>background colors</b></td></tr>\n  <tr>\n    <td align=center>40</td>\n    <td><code>BG_BLACK</code></td>\n    <td><code>bg_black</code></td>\n    <td>Set background color to black</td>\n  </tr>\n  <tr>\n    <td align=center>41</td>\n    <td><code>BG_RED</code></td>\n    <td><code>bg_red</code></td>\n    <td>Set background color to red</td>\n  </tr>\n  <tr>\n    <td align=center>42</td>\n    <td><code>BG_GREEN</code></td>\n    <td><code>bg_green</code></td>\n    <td>Set background color to green</td>\n  </tr>\n  <tr>\n    <td align=center>43</td>\n    <td><code>BG_YELLOW</code></td>\n    <td><code>bg_yellow</code></td>\n    <td>Set background color to yellow</td>\n  </tr>\n  <tr>\n    <td align=center>44</td>\n    <td><code>BG_BLUE</code></td>\n    <td><code>bg_blue</code></td>\n    <td>Set background color to blue</td>\n  </tr>\n  <tr>\n    <td align=center>45</td>\n    <td><code>BG_MAGENTA</code></td>\n    <td><code>bg_magenta</code></td>\n    <td>Set background color to magenta</td>\n  </tr>\n  <tr>\n    <td align=center>46</td>\n    <td><code>BG_CYAN</code></td>\n    <td><code>bg_cyan</code></td>\n    <td>Set background color to cyan</td>\n  </tr>\n  <tr>\n    <td align=center>47</td>\n    <td><code>BG_WHITE</code></td>\n    <td><code>bg_white</code></td>\n    <td>Set background color to white</td>\n  </tr>\n  <tr>\n    <td align=center><s>48;5</s></td>\n    <td colspan=\"2\" align=\"center\">\n        Use <code>color_c256()</code> instead\n    </td>\n    <td>Set background color [256 mode]</td>\n  </tr>\n  <tr>\n    <td align=center><s>48;2</s></td>\n    <td colspan=\"2\" align=\"center\">\n        Use <code>color_rgb()</code> instead\n    </td>\n    <td>Set background color [16M mode]</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>high-intensity [foreground] colors</b></td></tr>\n  <tr>\n    <td align=center>90</td>\n    <td><code>GRAY</code></td>\n    <td><code>gray</code></td>\n    <td>Set foreground color to bright black/gray</td>\n  </tr>\n  <tr>\n    <td align=center>91</td>\n    <td><code>HI_RED</code></td>\n    <td><code>hi_red</code></td>\n    <td>Set foreground color to bright red</td>\n  </tr>\n  <tr>\n    <td align=center>92</td>\n    <td><code>HI_GREEN</code></td>\n    <td><code>hi_green</code></td>\n    <td>Set foreground color to bright green</td>\n  </tr>\n  <tr>\n    <td align=center>93</td>\n    <td><code>HI_YELLOW</code></td>\n    <td><code>hi_yellow</code></td>\n    <td>Set foreground color to bright yellow</td>\n  </tr>\n  <tr>\n    <td align=center>94</td>\n    <td><code>HI_BLUE</code></td>\n    <td><code>hi_blue</code></td>\n    <td>Set foreground color to bright blue</td>\n  </tr>\n  <tr>\n    <td align=center>95</td>\n    <td><code>HI_MAGENTA</code></td>\n    <td><code>hi_magenta</code></td>\n    <td>Set foreground color to bright magenta</td>\n  </tr>\n  <tr>\n    <td align=center>96</td>\n    <td><code>HI_CYAN</code></td>\n    <td><code>hi_cyan</code></td>\n    <td>Set foreground color to bright cyan</td>\n  </tr>\n  <tr>\n    <td align=center>97</td>\n    <td><code>HI_WHITE</code></td>\n    <td><code>hi_white</code></td>\n    <td>Set foreground color to bright white</td>\n  </tr>\n\n  <tr><td colspan=\"4\"><br><b>high-intensity background colors</b></td></tr>\n  <tr>\n    <td align=center>100</td>\n    <td><code>BG_GRAY</code></td>\n    <td><code>bg_gray</code></td>\n    <td>Set background color to bright black/gray</td>\n  </tr>\n  <tr>\n    <td align=center>101</td>\n    <td><code>BG_HI_RED</code></td>\n    <td><code>bg_hi_red</code></td>\n    <td>Set background color to bright red</td>\n  </tr>\n  <tr>\n    <td align=center>102</td>\n    <td><code>BG_HI_GREEN</code></td>\n    <td><code>bg_hi_green</code></td>\n    <td>Set background color to bright green</td>\n  </tr>\n  <tr>\n    <td align=center>103</td>\n    <td><code>BG_HI_YELLOW</code></td>\n    <td><code>bg_hi_yellow</code></td>\n    <td>Set background color to bright yellow</td>\n  </tr>\n  <tr>\n    <td align=center>104</td>\n    <td><code>BG_HI_BLUE</code></td>\n    <td><code>bg_hi_blue</code></td>\n    <td>Set background color to bright blue</td>\n  </tr>\n  <tr>\n    <td align=center>105</td>\n    <td><code>BG_HI_MAGENTA</code></td>\n    <td><code>bg_hi_magenta</code></td>\n    <td>Set background color to bright magenta</td>\n  </tr>\n  <tr>\n    <td align=center>106</td>\n    <td><code>BG_HI_CYAN</code></td>\n    <td><code>bg_hi_cyan</code></td>\n    <td>Set background color to bright cyan</td>\n  </tr>\n  <tr>\n    <td align=center>107</td>\n    <td><code>BG_HI_WHITE</code></td>\n    <td><code>bg_hi_white</code></td>\n    <td>Set background color to bright white</td>\n  </tr>\n</table>\n\n</details>\n\n<details>\n<summary><b>Formats</b> <i>(click)</i></summary>\n\n- **name** &mdash; variable name; usage: `from pytermor.fmt import bold`\n- **opening seq**, **closing seq** &mdash; corresponding <i>SGR</i>s\n\nAs a rule of a thumb, **name** equals to **opening seq** in lower case.\n\n<table>\n  <tr>\n    <th>name</th>\n    <th>opening seq</th>\n    <th>closing seq</th>\n  </tr>\n  <tr><td colspan=\"3\"><br><b>attributes</b></td></tr>\n  <tr>\n    <td><code>bold</code></td>\n    <td><code>BOLD</code></td>\n    <td><code>BOLD_DIM_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>dim</code></td>\n    <td><code>DIM</code></td>\n    <td><code>BOLD_DIM_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>italic</code></td>\n    <td><code>ITALIC</code></td>\n    <td><code>ITALIC_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>underlined</code></td>\n    <td><code>UNDERLINED</code></td>\n    <td><code>UNDERLINED_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>inversed</code></td>\n    <td><code>INVERSED</code></td>\n    <td><code>INVERSED_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>overlined</code></td>\n    <td><code>OVERLINED</code></td>\n    <td><code>OVERLINED_OFF</code></td>\n  </tr>\n\n  <tr><td colspan=\"3\"><br><b>[foreground] colors</b></td></tr>\n  <tr>\n    <td><code>red</code></td>\n    <td><code>RED</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>green</code></td>\n    <td><code>GREEN</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>yellow</code></td>\n    <td><code>YELLOW</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>blue</code></td>\n    <td><code>BLUE</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>magenta</code></td>\n    <td><code>MAGENTA</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>cyan</code></td>\n    <td><code>CYAN</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>gray</code></td>\n    <td><code>GRAY</code></td>\n    <td><code>COLOR_OFF</code></td>\n  </tr>\n\n  <tr><td colspan=\"3\"><br><b>background colors</b></td></tr>\n  <tr>\n    <td><code>bg_black</code></td>\n    <td><code>BG_BLACK</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_red</code></td>\n    <td><code>BG_RED</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_green</code></td>\n    <td><code>BG_GREEN</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_yellow</code></td>\n    <td><code>BG_YELLOW</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_blue</code></td>\n    <td><code>BG_BLUE</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_magenta</code></td>\n    <td><code>BG_MAGENTA</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_cyan</code></td>\n    <td><code>BG_CYAN</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n  <tr>\n    <td><code>bg_gray</code></td>\n    <td><code>BG_GRAY</code></td>\n    <td><code>BG_COLOR_OFF</code></td>\n  </tr>\n</table>\n\n</details>\n\nYou can of course create your own sequences and formats, but with one limitation &mdash; autoformatting will not work with custom defined sequences; unless you add the corresponding rule to `pytermor.registry.sgr_parity_registry`.\n\n## Changelog\n\n### v1.8.0\n\n- `format_prefixed_unit` extended for working with decimal and binary metric prefixes;\n- `format_time_delta` extended with new settings;\n- Value rounding transferred from  `format_auto_float` to `format_prefixed_unit`;\n- Utility classes reorganization;\n- Unit tests output formatting;\n- `noop` SGR sequence and `noop` format;\n- Max decimal points for `auto_float` extended from (2) to (max-2).\n- \n### v1.7.4\n\n- Added 3 formatters: `fmt_prefixed_unit`, `fmt_time_delta`, `fmt_auto_float`.\n\n### v1.7.3\n\n- Added `bg_black` format.\n\n### v1.7.2\n\n- Added `ljust_fmtd`, `rjust_fmtd`, `center_fmtd` util functions to align strings with SGRs correctly.\n\n### v1.7.1\n\n- Print reset sequence as `\\e[m` instead of `\\e[0m`.\n\n### v1.7.0\n\n- `Format()` constructor can be called without arguments.\n- Added SGR code lists.\n\n### v1.6.2\n\n- Excluded `tests` dir from distribution package.\n\n### v1.6.1\n\n- Ridded of _EmptyFormat_ and _AbstractFormat_ classes.\n- Renamed `code` module to `sgr` because of conflicts in PyCharm debugger (`pydevd_console_integration.py`).\n\n### v1.5.0\n\n- Removed excessive _EmptySequenceSGR_ &mdash; default _SGR_ class without params was specifically implemented to print out as empty string instead of `\\e[m`.\n\n### v1.4.0\n\n- `Format.wrap()` now accepts any type of argument, not only _str_.\n- Rebuilt _Sequence_ inheritance tree.\n- Added equality methods for _Sequence_ and _Format_ classes/subclasses.\n- Added some tests for `fmt.*` and `seq.*` classes.\n\n### v1.3.2\n\n- Added `gray` and `bg_gray` format presets. \n\n### v1.3.1\n\n- Interface revisioning.\n\n### v1.2.1\n\n- `opening_seq` and `closing_seq` properties for _Format_ class.\n\n### v1.2.0\n\n- _EmptySequenceSGR_ and _EmptyFormat_ classes.\n\n### v1.1.0\n\n- Autoformat feature.\n\n### v1.0.0\n\n- First public version.\n\n## References\n\n- https://en.wikipedia.org/wiki/ANSI_escape_code\n- [ANSI Escape Sequences](https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "ANSI formatted terminal output library",
    "version": "1.8.0",
    "project_urls": {
        "Homepage": "https://github.com/delameter/pytermor"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0dc46a5424a1e509134481add38fca794cf0ea5d36104d999464f46cbcd53377",
                "md5": "f6c01aedc55cf50503e43238640bb5aa",
                "sha256": "b8b8a89943259d2d3241022ea84ec128942bf0c2d6cd990bb9d3b8a24962ec8c"
            },
            "downloads": -1,
            "filename": "pytermor-1.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f6c01aedc55cf50503e43238640bb5aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 23827,
            "upload_time": "2022-05-20T03:04:35",
            "upload_time_iso_8601": "2022-05-20T03:04:35.324506Z",
            "url": "https://files.pythonhosted.org/packages/0d/c4/6a5424a1e509134481add38fca794cf0ea5d36104d999464f46cbcd53377/pytermor-1.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b06f1838ae9ae7245eb910555420054fbb01fca9c8c2e7d5db7653f26a0d603",
                "md5": "2a32acee277e7482d5743b92545d7d4d",
                "sha256": "d61cbdd9e9780db02746320fd6aa039004d9780ac431a75543469512098feca2"
            },
            "downloads": -1,
            "filename": "pytermor-1.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2a32acee277e7482d5743b92545d7d4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 35798,
            "upload_time": "2022-05-20T03:04:37",
            "upload_time_iso_8601": "2022-05-20T03:04:37.765520Z",
            "url": "https://files.pythonhosted.org/packages/5b/06/f1838ae9ae7245eb910555420054fbb01fca9c8c2e7d5db7653f26a0d603/pytermor-1.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-05-20 03:04:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "delameter",
    "github_project": "pytermor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pytermor"
}
        
Elapsed time: 0.20806s