Fabulous

Version:0.1
Copyright:Copyright (c) 2010 J.A. Roberts Tunney

Installation

Run the following commands:

sudo apt-get install python-imaging
sudo python setup.py install

Modules

fabulous.xterm256

Implements Support for the 256 colors supported by xterm as well as quantizing 24-bit RGB color to xterm color ids.

Color quantization is very very slow so when this module is loaded, it’ll attempt to automatically compile a speedup module using gcc. A logging message will be emitted if it fails and we’ll fallback on the Python code.

fabulous.xterm256.compile_speedup()

Tries to compile/link the C version of this module

Like it really makes a huge difference. With a little bit of luck this should just work for you.

You need:

  • Python >= 2.5 for ctypes library
  • gcc (sudo apt-get install gcc)
fabulous.xterm256.rgb_to_xterm(r, g, b)

Quantize RGB values to an xterm 256-color ID

This works by envisioning the RGB values for all 256 xterm colors as 3D euclidean space and brute-force searching for the nearest neighbor.

This is very slow. If you’re very lucky, compile_speedup() will replace this function automatically with routines in _xterm256.c.

fabulous.xterm256.xterm_to_rgb(xcolor)

Convert xterm Color ID to an RGB value

All 256 values are precalculated and stored in COLOR_TABLE

fabulous.gotham

I implement functions to satisfy your darker side.

fabulous.gotham.lorem_gotham()

Cheesy Gothic Poetry Generator

Uses Python generators to yield eternal angst.

When you need to generate random verbiage to test your code or typographic design, let’s face it… Lorem Ipsum and “the quick brown fox” are old and boring!

What you need is something with flavor, the kind of thing a depressed teenager with a lot of black makeup would write.

fabulous.gotham.lorem_gotham_title()

Names your poem

fabulous.gotham.main(args)

I provide a command-line interface for this module