#ansi #color #encoding

bin+lib ansi-color-codec

Encode bytes as ANSI background colors

1 unstable release

0.3.11 Nov 17, 2022
0.3.5 Nov 14, 2022
0.2.9 Nov 13, 2022

#671 in Encoding

Custom license

289 lines


Encode arbitrary byte sequences with ANSI background colors.



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


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

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.


~105K SLoC