#ansi-colors #ansi #background-color #byte-sequences #color

bin+lib ansi-color-codec

Encode bytes as ANSI background colors

5 unstable releases

0.7.0 Aug 25, 2023
0.6.1 Jul 19, 2023
0.6.0 Jun 28, 2023
0.5.14 Jun 27, 2023
0.2.9 Nov 13, 2022

#817 in Encoding

Download history 29/week @ 2024-02-18 1/week @ 2024-02-25 1/week @ 2024-03-10 124/week @ 2024-03-31

125 downloads per month

MIT license

18KB
406 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().

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

~3–12MB
~118K SLoC