Recent Releases of https://github.com/apparebit/prettypretty
https://github.com/apparebit/prettypretty - tty-0.2.1
This is a bug fix release for the prettytty crate. The fuse! macro is now actually usable (and tested š³). Both fuse! and fuse_sgr! now create zero-sized structs that implement the usual autotraits. Their documentation has also been improved.
- Rust
Published by apparebit over 1 year ago
https://github.com/apparebit/prettypretty - v0.11.1 Appease docs.rs (hopefully and actually)
This release puts the pretty.css styles back into the crate, so that hopefully docs.rs can find them now.āI checked, it does.
- Rust
Published by apparebit over 1 year ago
https://github.com/apparebit/prettypretty - v0.11.0: Prettypretty goes modular
This release modularizes prettypretty's interface:
- The top-level
prettyprettymodule implements high-resolutionColors and translation between color representations viaTranslator. - The
termcomodule defines terminal-specific color representations, such asAnsiColorand [Rob], as well as the catch-allColorantenumeration. - The
stylemodule implements terminalStyles as a combination of textFormatand foreground as well as backgroundColorants. It also definesLayerto distinguish between the two color bands andFidelityto represent terminals' hardware capabilities. - The
thememodule represents the terminal's current colorTheme. - The optional
gamutandspectrummodules support traversing the gamuts of color spaces and human vision. They are enabled with thegamutfeature, which is off by default.
To actually interact with the terminal, prettypretty now optionally interfaces with the prettytty crate. Unlike other terminal crates for Rust, prettytty is engineered to be lightweight and dependency-free. It only depends on one of the platform crates libc (Unix) or windows-sys (Windows). The tty feature, which is on by default, enables this integration. However, when building the Python extension module, the tty feature is disabledāuse prettypretty.terminal.Terminal insteadāand the gamut feature is enabledāensuring that batteries are included.
The much improved plot.py script for visualizing colors in the Oklab color space and the new viz3d.py script for visualizing the volume of the human visual gamut leverage the extension module's functionality to their fullest.
- Rust
Published by apparebit over 1 year ago
https://github.com/apparebit/prettypretty - v0.10.0 Assorted improvements
This release bundles assorted improvements, notably to the documentation. It bumps the minor version as indicator of potential breakage: Sampler::adjust is now known as Sampler::cap.
- Rust
Published by apparebit almost 2 years ago
https://github.com/apparebit/prettypretty - v0.9.0 Unity!
Iām happy to present the Unity! release of prettypretty, my library for awesome terminal colors. Core color functionality is now implemented in Rust only, with PyO3 providing integration with Python through an extension module. At the same time, thanks to a liberal sprinkling of #[cfg] and related annotations, the Rust crate continues to build by itself. Moving forward, both Rust and Python versions will be released together. For the next few releases, the focus will be to port remaining Python-only code over to Rust and integrate the new functionality with the extension module.
This release not only ups the game when it comes to the projectās engineering. It also introduces a new user guide with code examples in both languages and adds plenty of new features. Notably, they include a complete implementation of the CSS Color 4 algorithm for color interpolation, including support for missing components and hue interpolation strategies.
But Iām particularly proud to include my first color algorithm of my own design. It translates high-resolution to ANSI colors and yields more consistent results than brute force search in Oklab, which remains supported. The new algorithm turns an oddity, ANSI colorsā lack of intrinsic color values, into a strength and picks the closest matching pair of regular and bright ANSI colors by hue and then selects the final result based on lightness. Since that wonāt work with color themes that violate the semantics of ANSI colors, the implementation transparently falls back onto brute force search for such color themes.
Additional experiments with a cleaned up version of Chalkās algorithm for translation to ANSI colors demonstrate that this popular JavaScript library reliably produces unacceptable results. Thatās pretty ironic for a library with the tagline āTerminal string styling done right.ā I think there is an easy way to fix this: Anyone interested in taking on the integration of prettypretty with Node.js and Demo.js? The latter should be straight-forward since it already has a Rust-based core.
- Rust
Published by apparebit almost 2 years ago
https://github.com/apparebit/prettypretty - Oxidized Colors v0.1.1
Nowadays, many terminal emulators are being written in Rust. So that they too can benefit from awesome color support, here is the Rust version of prettypretty. The crate is BYOIO (Bring Your Own I/O) for now, i.e., there is no support for reading and writing ANSI escape codes. But the crate's color support is first class. In fact, it currently surpasses that of the Python version and includes the Oklrab and Oklrch color spacesāthink Oklab 2.0. Other than that, have a look at the documentation. It has plenty of code examples and shiny color swatches, too!
- Rust
Published by apparebit almost 2 years ago
https://github.com/apparebit/prettypretty - Alright Mr DeMille, I'm ready for my close-up!
Prettypretty is ready for that close-up indeed: It takes care of your application's styling needs, adjusting to a user's color theme, dark or light mode, and color preferences. The documentation provides a walk-through of an example script for display a progress bar as well as a detailed explanation of the underlying color transformations. Check it out!
- Rust
Published by apparebit about 2 years ago
https://github.com/apparebit/prettypretty - A first taste of awesome terminal colors
When working with colors, even fifty-year-old terminal colors, it's a good idea to do most analysis and transformations in a perceptually uniform color space. Prettypretty makes it possible to convert the 16 extended ANSI colors, the 6x6x6 RGB cube, and the 24-step gray gradient into Oklab and Oklch. Awesomeness is the result!
- Rust
Published by apparebit about 2 years ago