#color #ansi

app ansi-color-codec-cli

Encode bytes as ANSI background colors

4 stable releases

Uses new Rust 2024

3.0.1 Oct 2, 2025
2.0.0 Jul 17, 2025
1.0.2 Jul 11, 2025

#671 in Encoding

Download history 241/week @ 2025-09-30 24/week @ 2025-10-07 14/week @ 2025-10-14 1/week @ 2025-10-21

470 downloads per month

MIT license

7KB
58 lines

ansi-color-codec

Encode arbitrary byte sequences with ANSI background colors.

showcase.webm

Usage

You can use the program as a library or as a command line utility.

Library

The library provides a trait ColorCodec<T> that allows arbitrary byte iterators (Iterator<Item = u8>) to encode their bytes as ANSI background color codes or decode them back again. Therefor the trait provides the functions encode() and decode().

The library is no_std as does not require alloc.

Command line utility

You can encode bytes or decode color codes by passing them to ansi-color-codec's STDIN:

$ echo "I use Arch btw" | ansi-color-codec
$ echo "I use Arch btw" | ansi-color-codec | ansi-color-codec -d

For more options, see ansi-color-codec -h.

Dependencies

~2.6–5.5MB
~103K SLoC