Project page: http://xyne.archlinux.ca/projects/python3-colorsysplus/
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.
Last edited by Xyne (2012-10-22 07:50:07)
The package now contains a supplementary module for working with colorized text. It can convert to and from HTML, BBCode, ANSI, etc. and provides some functions for applying custom gradients and other fun stuff. This text was generated with the code. It could have just as easily been display in a compatible terminal.
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!
Shameless self-bump to say that I have moved the ANSI functions from python3-xcgf to python3-colorsysplus in case anyone needs some simple python functions for displaying colored terminal text with other common ANSI select graphics rendition options (bold, blink, negative).
#!/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)
I had forgotten about this Xyne. Made my day
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
You assume people are rational and influenced by evidence. You must not work with the public much. -- Trilby
How to Ask Questions the Smart Way
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.