Added a command-line utility for piping fun:
pacman --color always -Ss colorsys | ctconv ansi bbcode
xyne-x86_64/python3-colorsysplus 2013-5 [installed: 2015.12-1]
An extension of the standard colorsys module with support for CMYK, terminal colors, ANSI and more.
Example:
#!/usr/bin/env python
from colorsysplus import ansi_sgr
s = ansi_sgr(fg='red', bold=True, blink=True) + \
'BLINKING TERMINAL TEXT IS ANNOYING, ISN\'T IT?' + \
ansi_sgr(reset=True)
print(s)
Yes, I am aware that I appear to have too much time on my hands. In fact, the opposite is true. This is the result of procrastination and escapism.
But hey, look at the pretty colors! No, not the clock, the colors!
]]>Over time I've written a lot of code to manage color conversions between different formats (hexadecimal, terminal, ANSI, CMYK, etc). Some of it has found its way into some of my projects (e.g. pychrom and tiv, both of which were written as afterthoughts from messing around with colors), but it's never really been directly accessible.
I finally got tired of cannibalizing my own code whenever I needed some conversion functions so I put everything in a single module and packaged it.
The source code is reasonably documented and relatively straight-forward, so it should be easy to use.
Anyone interested in this may also be interested in Lux Perpetua's script from which some of the code was adapted/cannibalized.
If you have any suggestions for additional functionality or ways that the existing code could be improved, let me know.
edit: screenshot