Phonochrome is a bijective 8-bit RGB encoding library that generates phonotactically plausible appellations. The library constructs a unique string for each of the 16.7 million possible 8-bit RGB tuple permutations (
Each RGB component is first converted to base 16, which allows us to derive values from a more compact set of characters, represented as
The library is extremely easy to use, and comes with two functions: encode
and decode
.
>>> import phonochrome
>>> black_rgb = (0, 0, 0) # define our RGB tuple
>>> phonochrome.encode(black_rgb) # encode the RGB into a phonochrome appellation
'bacedi'
>>> import phonochrome
>>> phonochrome.decode('bacedi') # decode the phonochrome appellation into an RGB
(0, 0, 0)
Phonochrome comes with a command line interface which is automatically added to your environment's scripts upon installation. You can invoke it like this:
$ phonochrome encode 122 16 14
'kusdeda'
$ phonochrome decode kusdeda
(122, 16, 14)
$ phonochrome --help
usage: phonochrome [-h] {encode,decode} ...
Phonochrome: A bijective 8-bit RGB encoding library that generates phonotactically plausible appellations.
options:
-h, --help show this help message and exit
Commands:
{encode,decode}
encode Encode an 8-bit RGB tuple into a phonochrome appellation.
decode Decode a phonochrome appellation into an 8-bit RGB tuple.
In the event that an invalid argument was passed to encode/decode, the script will terminate with exit code 2, otherwise code 0.
$ phonochrome encode 295 543 712
Error: Invalid 8-bit RGB tuple: (295, 543, 712)
$ phonochrome decode invalid
Error: Invalid appellation: 'invalid'
Install from pip:
pip install phonochrome