Skip to content

v6.1.0: Fancy repr protocol!

Compare
Choose a tag to compare
@bczsalba bczsalba released this 17 May 15:13
· 343 commits to master since this release

This version was mostly for bugfixing, but it introduces the new __fancy_repl__ protocol into the library.

The purpose of this protocol is for objects to gain control over how they are displayed in a pretty REPL environment. See the docs for more info.

There is also now support for string format specs for Color objects. You can now do things like:

markup = f"[{color:tim}]Text"

and I think that's pretty neat.

Changelog

Additions

  • Introduce __fancy_repr__ protocol (09bcb0e)

    This protocol is somewhat inspired by rich's __rich__, but tries to be agnostic to the underlying ANSI interface used. It can be used to customize highlighting an object's repr output.

    It is already implemented by all the Color classes, and RegexHighlighter. More (probably) to come.

  • Add Color format specifiers (c529c2c)

  • Add Animation.pause & Animation.unpause (bf7ddbd)

Bugfixes

  • Fix scrolled widgets not getting positioned correctly (29a2aeb)
  • Fix an issue with 2-bit colors being interpreted as 8-bit ones (632ac1b, #56)

Refactors

Showcase

Screenshot 2022-05-17 at 17 09 46