thomasballinger / fmtstr

temporary name, this term is overloaded
3 stars 3 forks source link

Support for more colors! #8

Open thomasballinger opened 10 years ago

thomasballinger commented 10 years ago

I like the approach of @gwk in https://github.com/gwk/gloss/blob/master/python/gloss/io/sgr.py, I think we should copy that for the most part.

gwk commented 10 years ago

i'm flattered :) one thing to consider: that implementation emphasizes readability and flexibility; you can use sgr() to string together complicated rendering commands. one alternative would be to just pre-format a bunch of complete control sequence strings, and provide those as constants. this reduces verbosity and function call overhead for library users at the expense of slightly longer output strings (because you cannot coalesce e.g. bold/white-text/red-background). i think this is a reasonable trade-off, and i would probably take that approach in a new implementation.

miclovich commented 10 years ago

:+1: pretty cool