* Matricizer.choose_dimensions was not actually being used. It has been
removed, and dimensions of the hash matrix are now determined
internally by the matricizer, rather than in its constructor.
* Linter was complaining about missing documentation and some other
minor styling things so those are fixed
* Linter had a few more stupid lints enabled ("too-many-statements"?
really? god forbid your code is too long, I'm not a computer science
student, come on guys)
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Colorizer was a class-based thing but it doesn't really need to be,
because everything is colorized using palettes. If we need to use a
different style of colorization in the future, we will bring the
colorizer class back.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Add a simple JS port of colorhash for easier demonstration purposes. You
don't need to open a command line to create a colorhash, you can just
use the webpage.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Big oops on my part. The Randomart was looking a bit "same-y", and for a
good reason. The algorithm should be going in two-bit chunks at a time,
but I completely forgot to shift the bits over every time. This is added
now, huge mistake on my part whoopsie
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Usually you want to `git add` when you run gencommit.sh, so that has
been added.
Also, add ANSI output because I like to see what we're generating while
in the terminal.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
StaticPalette was not really being used besides as a list wrapper, so
that is removed. Palette type is getting some use in the rest of the
codebase, so I have redefined that type as a Sequence[str], becauase
that's basically what it is.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This is useful so we aren't wasting cycles generating examples that
don't need to be generated and we just cut to the chase
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This tries to add a bit more color distinction to the randomart
algorithm. As it so happens, half of the randomart examples got
converted to using the new palette, so that's a nice little win.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This is so we aren't committing binary data to the git repository if
that data may get updated in the future because I decide to make changes
to algorithms, palettes, etc. It's still nice to get the png files
generated so they can stay.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Regenerating the fullsource hash was a bit tedious. Instead, it makes a
bit more sense to use the current commit hash as the header image. This
uses sha1 nibbleart.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
We don't reeeeaaaaally need PNG files for this, plus if we include PNGs
it will make the repository unwieldy and annoying.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This will just do a `cat` of all Python files in the colorhash/
directory and shove it into a fullsource.in file.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
ANSI-based color output is available and now the default. Add a
-y / --output-type argument to select SVG or ANSI output. Also update
tools/genexamples.sh to use the SVG output type.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Generally, palettes are expressed using HSL, but sometimes we want the
output to be in RGB (or some other format). Colors are now expressed
using either RGBColor or HSLColor and can easily be converted between
the two.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
CLI implementation will now live in colorhash/cli.py, and __main__ will
just import and call the cli_main() function.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Matricizers select color palettes now. This is motivated by the fact
that the gradient palettes don't really look good for openssh randomart
based art, and rainbows do look good.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Introduce a new function called `hsl_colors` and a helper `quantize`
function that creates palettes using HSL values on the fly. Default
palettes are now split into "<colorname>-dark" and "<colorname>-light"
for more variation.
In my experiments, red-centric colors seem to be more distinguishable
than others. You have red, green, blue - you can tell they're distinct.
Interleaved between these you have yellow, cyan, and magenta, also
distinct. But between yellow and green, or green and cyan, these colors
feel less distinct than orange, purple or pink. I have opted to elide
non-red "in-betweens" such as those. So we have a dark and light variant
of the following colors as palettes:
red, orange, yellow, green, cyan, blue, purple, magenta, pink, gray, and
also a rainbow palette that is every color at its full saturation.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
* Palette choices are determined by the list of palettes available and
not hard-coded
* Auto palette is chosen by the length of the palette choices rather
than hard-coded
* Palette help listing is text-wrapped at 70 characters
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This tool will go through the examples directory and generate an image
for all *.in files using every hash and matrix option.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>