{ "info": { "author": "Will Drach", "author_email": "will.drach@live.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: Public Domain", "Natural Language :: English", "Operating System :: Unix", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=======\r\npycolor\r\n=======\r\n\r\nA color module for python\r\n=====\r\nSetup\r\n=====\r\n\t$ git clone https://github.com/Merglyn/pycolor.git\r\n\t$ cd pycolor\r\n\t$ sudo python setup.py install\r\n\r\nor\r\n\r\n\t$ sudo pip install pycolor\r\n\r\n=====\r\nIntro\r\n=====\r\n\r\nAnsi color in python sucks. You basically have a handful of options, all of\r\nwhich have their benefits but none of which really get the job done.\r\n\r\n* Colorama\r\n\t* Colorama is good, but it has limited color support (8 colors...)\r\n* Termcolor\r\n\t* Termcolor is basically Colorama without Windows support (8 colors, again)\r\n* Fabulous\r\n\t* Fabulous seems cool, but it is questionable whether or not it is kept up\r\n\tto date\r\n* Blessings\r\n\t* Blessings is way too complicated\r\n\r\nWith pycolor you can kinda do whatever you want and it'll work. 256 color\r\nsupport and attribute support, as well as the typical 8 color support. We also\r\ndo rainbow, because we're gangster like that.\r\n\r\n========\r\nExamples\r\n========\r\n\r\nprint blue text\r\n---------------\r\n\r\n\timport color\r\n\tfrom color import color_string\r\n\tour_string = 'Testing that color module'\r\n\tprint_color(our_string, fg_color = 'blue')\r\n\r\nreturn rainbows, and then print that to stderr\r\n----------------------------------------------\r\n(gotta have some fun reading old logs right?)\r\n\r\n\timport color\r\n\timport sys\r\n\tfrom color import color_string\r\n\tfrom sys import stderr\r\n\tprint('nyan')\r\n\terror_nyan = color_string('ERROR! Unexpected Nyan\\n', fg_color = 'rainbow')\r\n\tstderr.write(error_nyan)\r\n\r\nprint some black text on white background\r\n-----------------------------------------\r\n\r\n\timport color\r\n\tfrom color import print_color\r\n\tprint_color('some black text on white background',\r\n fg_color = 'black',\r\n bg_color = 'white')\r\n=========\r\nFunctions\r\n=========\r\n\r\n`fg (object)`:\r\n--------------\r\n\r\n`fg` is an object within color that will return a simple escape sequence for \r\na specified color. fg is only meant to be used with the standard 16 colors(\r\nblack, red, green, yellow, blue, magenta, cyan, white, lightred, \r\nlightgreen, lightyellow, lightblue, lightmagenta, lightcyan). To set the \r\nescape sequence just call `fg.color` (i.e. `fg.lightblue`). The reset sequence\r\ncan be called by `fg.reset` or just `fg.re`. Lastly, you can call colors by \r\ntheir one or two letter designation (b, r, g, y, bl, m, c, w, lr, lg, ly, \r\nlb, lm, lc, respectively) in the same manner (i.e. `fg.lb`)\r\n\r\n`bg (object)`:\r\n--------------\r\n\r\n`bg` is exactly the same in every way as `fg`, except it returns the\r\nbackground escape sequence instead of the foreground escape sequence\r\n\r\n`atr (object)`:\r\n---------------\r\n\r\natr works similarly to bg and fg, except it is for attributes. Supported\r\nattributes are `reset_all`, `bold`, `dim`, `underline`, `blink`, and\r\n`negative`. The short names are `ra`, `bo`, `d`, `ul`, `bl`, and `n`\r\nrespectively\r\n\r\n`reset_all`:\r\n------------\r\n\r\n`reset_all` resets all attributes, formatting, and colors. Usually only used\r\ninternally, but can be useful nonetheless\r\n\r\n`get_bold, get_dim, get_underline, get_blink(speed), get_negative`:\r\n-------------------------------------------------------------------\r\n\r\nThese get functions return their respective escape sequences. `get_blink`\r\ntakes a single input being the speed (which is either 0 or 1)\r\n\r\n`get_color_esc(attribute, color)`:\r\n----------------------------------\r\n\r\n`get_color_esc` returns the escape sequence for the given color. It takes\r\ntwo variables, attribute, which is either `'fg'` or `'bg'`, and the color,\r\nwhich can be a number from 0 to 256 or a valid xterm 256 color name\r\n\r\n`make_rainbow(string, start_color='rand')`:\r\n-------------------------------------------\r\n\r\n`make_rainbow` is mostly for internal use, use `color_string(fg_color =\r\n'rainbow')` or `print_color(fg_color = 'rainbow')`\r\n\r\n`color_string(string, attribute = 'none', fg_color = 'none', bg_color = 'none')`:\r\n---------------------------------------------------------------------------------\r\n\r\n`color_string` takes a variety of variables to return a string that is\r\ncoupled with various escape sequences. Attribute is one of the attributes\r\nin atr (ra, bo, d, ul, bl). Similarly `fg_color` and `bg_color` can be set to\r\nany color from get_color_esc. string is simply the string you want colored.\r\n\r\n`print_color(string, attribute = 'none', fg_color = 'none', bg_color = 'none')`:\r\n--------------------------------------------------------------------------------\r\n\r\n`print_color` works exactly the same as color_string except for instead of\r\nreturning the string it prints it to stdout.\r\n\r\n===================\r\nLicense, bugs, etc.\r\n===================\r\n\r\nPycolor is licensed under beerware r42.\r\nThrow me a msg at will.drach@live.com if you have some issue or whatever.\r\nAlso feel free to dm me on Twitter @Merglyn or reddit /u/Merglyn.\r\nYou can also learn more about Pycolor at http://www.drach.co/pycolor", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.drach.co/pycolor", "keywords": "ansi color terminal colors", "license": "Beerware", "maintainer": "", "maintainer_email": "", "name": "Pycolor", "package_url": "https://pypi.org/project/Pycolor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Pycolor/", "project_urls": { "Homepage": "http://www.drach.co/pycolor" }, "release_url": "https://pypi.org/project/Pycolor/1.2.1/", "requires_dist": null, "requires_python": null, "summary": "Ansi color for python", "version": "1.2.1" }, "last_serial": 1268954, "releases": { "1.2.0": [ { "comment_text": "", "digests": { "md5": "51f5fd333acba1b958f523f5e6330996", "sha256": "b7a8381e0ed4608c6c619def799b0622221faa63c090feb23caeb284a91720c3" }, "downloads": -1, "filename": "Pycolor-1.2.0.tar.gz", "has_sig": false, "md5_digest": "51f5fd333acba1b958f523f5e6330996", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4847, "upload_time": "2014-10-12T02:40:09", "url": "https://files.pythonhosted.org/packages/30/8d/ba36fe09ea28bd2c28209ba4ae1bb50941c1df7125fc7fefc81fb6584c91/Pycolor-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "0ebf77257c0a32814f9e2ac2b127e4d9", "sha256": "dbd8cb9a293bc95c96fca416b9f542f68bc4a3c2437c681ce460fb9518a936e1" }, "downloads": -1, "filename": "Pycolor-1.2.1.tar.gz", "has_sig": false, "md5_digest": "0ebf77257c0a32814f9e2ac2b127e4d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4829, "upload_time": "2014-10-12T02:44:18", "url": "https://files.pythonhosted.org/packages/86/ba/69c3ded6f20fc2397ad5e82df509c46697931e6bfe7a6841df0029a05a77/Pycolor-1.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0ebf77257c0a32814f9e2ac2b127e4d9", "sha256": "dbd8cb9a293bc95c96fca416b9f542f68bc4a3c2437c681ce460fb9518a936e1" }, "downloads": -1, "filename": "Pycolor-1.2.1.tar.gz", "has_sig": false, "md5_digest": "0ebf77257c0a32814f9e2ac2b127e4d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4829, "upload_time": "2014-10-12T02:44:18", "url": "https://files.pythonhosted.org/packages/86/ba/69c3ded6f20fc2397ad5e82df509c46697931e6bfe7a6841df0029a05a77/Pycolor-1.2.1.tar.gz" } ] }