{ "info": { "author": "Jonathan Eunice", "author_email": "jonathan.eunice@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: ISC License (ISCL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "\n| |travisci| |version| |versions| |impls| |wheel| |coverage| |br-coverage|\n\n.. |travisci| image:: https://api.travis-ci.org/jonathaneunice/colors.svg\n :target: http://travis-ci.org/jonathaneunice/colors\n\n.. |version| image:: http://img.shields.io/pypi/v/ansicolors.svg?style=flat\n :alt: PyPI Package latest release\n :target: https://pypi.python.org/pypi/ansicolors\n\n.. |versions| image:: https://img.shields.io/pypi/pyversions/ansicolors.svg\n :alt: Supported versions\n :target: https://pypi.python.org/pypi/ansicolors\n\n.. |impls| image:: https://img.shields.io/pypi/implementation/ansicolors.svg\n :alt: Supported implementations\n :target: https://pypi.python.org/pypi/ansicolors\n\n.. |wheel| image:: https://img.shields.io/pypi/wheel/ansicolors.svg\n :alt: Wheel packaging support\n :target: https://pypi.python.org/pypi/ansicolors\n\n.. |coverage| image:: https://img.shields.io/badge/test_coverage-100%25-6600CC.svg\n :alt: Test line coverage\n :target: https://pypi.python.org/pypi/ansicolors\n\n.. |br-coverage| image:: https://img.shields.io/badge/branch_coverage-100%25-6600CC.svg\n :alt: Test branch coverage\n :target: https://pypi.python.org/pypi/ansicolors\n\nANSI colors for Python\n======================\n\nAdd ANSI colors and decorations to your strings.\n\nExample Usage\n-------------\n\n::\n\n from __future__ import print_function # accomodate Python 2\n from colors import *\n\n print(color('my string', fg='blue'))\n print(color('some text', fg='red', bg='yellow', style='underline'))\n\nThe strings returned by ``color`` will have embedded\n`ANSI code sequences `_\nstipulating text colors and styles. For example, the above\ncode will print the strings::\n\n '\\x1b[34mmy string\\x1b[0m'\n '\\x1b[31;43;4msome text\\x1b[0m'\n\nYou can choose the foreground (text) color with the ``fg`` parameter,\nthe background color with ``bg``, and the style with ``style``.\n\nYou can choose one of the 8 basic ANSI colors: ``black``, ``red``, ``green``,\n``yellow``, ``blue``, ``magenta``, ``cyan``, and ``white``, plus a special\n``default`` which is display-specific, but usually a rational \"no special\ncolor\" setting.\n\nThere are other ways to specify colors. Many devices support\nan idiosyncratic 256-color scheme developed as an extension to\nthe original ANSI codes for the\n`xterm terminal emulator `_.\nColors (or grays) from this larger palette can be specified via ``int``\nvalue (0-255).\n\nTo see them all::\n\n from __future__ import print_function\n from colors import color\n\n for i in range(256):\n print(color('Color #%d' % i, fg=i))\n\n\nThe included ``show_colors.py`` program is a much-expanded version of this idea\nthat can be used to explore available color and style combinations on your\nterminal or output device.\n\n24-bit Color and CSS Compatibility\n----------------------------------\n\nModern terminals go even further than the ``xterm`` 256, often supporting a\nfull 24-bit RGB color scheme. You can provide a full RGB value several ways:\n\n* with a 3-element ``tuple`` or ``list`` of ``int``, each valued 0 to 255 (e.g. ``(255, 218, 185)``),\n* a string containing a CSS-compatible color name (e.g. ``'peachpuff'``),\n* a string containing a CSS-style hex value (e.g. ``'#aaa'`` or ``'#8a2be2'``)\n* a string containing a CSS-style RGB notation (e.g. ``'rgb(102,51,153)'``)\n\nThese forms can be mixed and matched at will::\n\n print(color('orange on gray', 'orange', 'gray'))\n print(color('nice color', 'white', '#8a2be2'))\n\nNote that any color name defined in the basic ANSI color set takes\nprimacy over the CSS color names. Combined with the fact that\nterminals do not always agree which precise tone of blue should\nqualify as ANSI ``blue``, there can be some ambiguity regarding\nthe named colors. If you need full precision, specify the RGB\ncolor exactly. The ``parse_rgb`` function can be used to identify\nthe correct definition according to the CSS standards.\n\nCaveats\n-------\n\nUnfortunately there is no guarantee that every terminal will support all the\ncolors and styles ANSI ostensibly defines. In fact, most implement a rather\nsmall subset. Colors are better supported than styles, for which you *might* get\none or two of the most popular such as ``bold`` or ``underline``.\n*Might.*\n\nWhatever colors and styles are supported, there is no guarantee they will be\naccurately rendered. Even at this late date, over **fifty years** after the codes\nbegan to be standardized, support from terminals and output devices is limited,\nfragemented, and piecemeal.\n\nANSI codes evolved in an entirely different historical context from today's.\nBoth the Web and the idea of broad standardization were decades in the future.\nDisplay technology was low-resolution, colors were limited on the rare occasions\nthey were present, and color/style fidelity was not a major consideration.\nVendors thought little or nothing of creating their own proprietary codes,\nimplementing functions differently from other vendors, and/or co-opting codes\npreviously in use for something else. Practical ANSI reference materials\ninclude *many* phrases such as 'hardly ever supported' and 'non-standard.'\n\nWe still use ANSI codes today not because they're especially good, but because\nthey're the best, most-standard approach that pre-Web displays even remotely\nagreed upon. Even deep into the Web era, text output endures as an important\nmeans of human-computer interaction. The good news, such is it is: ANSI's color\nand style specifications (\"SGR\" or \"Select Graphic Rendition\" in ANSI\nterminology) are the most-used and best-adhered-to portion of the whole ANSI\nshow.\n\nMore Examples\n-------------\n\n::\n\n # use some partial functions\n\n from __future__ import print_function # so works on Python 2 and 3 alike\n from colors import red, green, blue\n\n print(red('This is red'))\n print(green('This is green'))\n print(blue('This is blue'))\n\nOptionally you can add a background color and/or styles.::\n\n print(red('red on blue', bg='blue'))\n print(green('green on black', bg='black', style='underline'))\n\nYou can use multiple styles at once. Separate them with\na ``+``.::\n\n print(red('very important', style='bold+underline'))\n\nYou can additionally specify one of the supported styles: ``none``, ``bold``,\n``faint``, ``italic``, ``underline``, ``blink``, ``blink2``, ``negative``,\n``concealed``, ``crossed``. While most devices support only a few styles,\nunsupported styles are generally ignored, so the only harm done is your text is\nless pretty and/or formatted than you might like. A good general rule is\nto enjoy the formatting if you get it, but don't depend on it--especially\ndon't depend on styles like ``blink`` (e.g. to highlight critical data) or\n``concealed`` (e.g. to hide data). Most likely, they won't.\n\nIf you use a style often, you may want to create your own\nnamed style::\n\n from functools import partial\n from colors import color\n\n important = partial(color, fg='red', style='bold+underline'))\n\n print(important('this is very important!'))\n\nUtility Functions\n-----------------\n\nIn deailing with ANSI-styled text, it can be necessary to determine the\n\"equivalent\" text minus the styling. The function ``strip_color(s)`` does that,\nremoving ANSI codes from ``s``, returning its \"plain text equivalent.\"\n\nYou may also wish to determine the effective length of a string. If it contains\nANSI codes, the builtin ``len()`` function will return the length including\nthose codes, even though they are logically 0-length. So plain ``len(s)`` is\nprobably not what you need. ``ansilen(s)`` in contrast returns the \"effective\"\nlength of the string, including only the non-ANSI characters. ``ansilen(s)`` is\nequivalent to ``len(strip_color(s))``,\n\nLicense\n-------\n\n``colors`` is licensed under the `ISC license `_.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jonathaneunice/colors/", "keywords": "ASNI color style console", "license": "ISC", "maintainer": "", "maintainer_email": "", "name": "ansicolors", "package_url": "https://pypi.org/project/ansicolors/", "platform": "", "project_url": "https://pypi.org/project/ansicolors/", "project_urls": { "Homepage": "http://github.com/jonathaneunice/colors/" }, "release_url": "https://pypi.org/project/ansicolors/1.1.8/", "requires_dist": null, "requires_python": "", "summary": "ANSI colors for Python", "version": "1.1.8" }, "last_serial": 2921529, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "eec189b741484dd02978201b63c8776b", "sha256": "b9939282b70085e76ff7ca17c665709b12c425952ca2947e5a40c362d4b7ce75" }, "downloads": -1, "filename": "ansicolors-1.0.tar.gz", "has_sig": false, "md5_digest": "eec189b741484dd02978201b63c8776b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2903, "upload_time": "2012-04-03T21:18:35", "url": "https://files.pythonhosted.org/packages/af/f1/2ac4713c332bd2799bc5d6227b2c43be6d8d5865f90b6529c38cdb1449cd/ansicolors-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "fdaedb96ba38589f6f05a06b36ef9372", "sha256": "631686a6f8883b330680cda9521fb1ab3fc3ed440b3b9f9cdadf9c7845748d06" }, "downloads": -1, "filename": "ansicolors-1.0.1.tar.gz", "has_sig": false, "md5_digest": "fdaedb96ba38589f6f05a06b36ef9372", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2990, "upload_time": "2012-04-03T22:16:18", "url": "https://files.pythonhosted.org/packages/f4/52/7b2cf147805ba9f9d3ecece890346eea12a3a36a91607617184ece271837/ansicolors-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "d3a19fcd75c89772360e0d2b693fc50f", "sha256": "7664530bb992e3847b61e3aab1580b4df9ed00c5898e80194a9933bc9c80950a" }, "downloads": -1, "filename": "ansicolors-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d3a19fcd75c89772360e0d2b693fc50f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3130, "upload_time": "2012-04-18T19:30:07", "url": "https://files.pythonhosted.org/packages/ac/c1/e21f0a1258ff927d124a72179669dcc7efcb57b22df8cd0e49ed8f1a308c/ansicolors-1.0.2.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "6fefe24f4b19228310084a4ef59da754", "sha256": "32ade89a29d1dcc626dddf8dbcd03a8fdc61cb1460bb67f1af038eaf240fe084" }, "downloads": -1, "filename": "ansicolors-1.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6fefe24f4b19228310084a4ef59da754", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 13362, "upload_time": "2017-05-26T22:53:57", "url": "https://files.pythonhosted.org/packages/68/4a/7da3dbcf42a1a95326308effdfb28341b673d8234489907bf58951fa81fa/ansicolors-1.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fb7c619c22ddc919d596bd9027ee229b", "sha256": "2a2d54e6680a05a3ad90a1a63fa43f4fa9ffec2941688118d6a3cdbf9e4ddb66" }, "downloads": -1, "filename": "ansicolors-1.1.5.zip", "has_sig": false, "md5_digest": "fb7c619c22ddc919d596bd9027ee229b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20198, "upload_time": "2017-05-26T22:53:55", "url": "https://files.pythonhosted.org/packages/32/fc/0dd47dc71a69ac3d381d2bf7fbe79dc65c39ff1bc400e7e2f445f7422f80/ansicolors-1.1.5.zip" } ], "1.1.6": [ { "comment_text": "", "digests": { "md5": "93cdfc84a2bdc32586795a061fdfe283", "sha256": "e471e2364ecf78bd01868f9ad05b036aad3f572cba37278a3126d8b460812756" }, "downloads": -1, "filename": "ansicolors-1.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "93cdfc84a2bdc32586795a061fdfe283", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 13430, "upload_time": "2017-05-26T23:07:53", "url": "https://files.pythonhosted.org/packages/ca/50/1f7d0da89bd9baa0093e682c768190e5f1802101c51a5e1d6fdd4e555ec5/ansicolors-1.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d11ee244447fbad352be1524c3538f97", "sha256": "abbcb8df81fd0245a6aaacf3342baa281dcf13a29c302a9612355f3b675362b2" }, "downloads": -1, "filename": "ansicolors-1.1.6.zip", "has_sig": false, "md5_digest": "d11ee244447fbad352be1524c3538f97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20287, "upload_time": "2017-05-26T23:07:51", "url": "https://files.pythonhosted.org/packages/a7/3b/2695aa5ecd634ad980f1cb0aa8977bb46da3cde8461e8a70a8bacd3482d8/ansicolors-1.1.6.zip" } ], "1.1.7": [ { "comment_text": "", "digests": { "md5": "a348ebdae7d7e6b049fbcf97c106d3d6", "sha256": "356a3aa705fc03ce6f4266af14cb1c5b76cfd32550a3e87e9e3d24ac458ab1c4" }, "downloads": -1, "filename": "ansicolors-1.1.7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a348ebdae7d7e6b049fbcf97c106d3d6", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 13806, "upload_time": "2017-06-02T21:04:38", "url": "https://files.pythonhosted.org/packages/9e/9e/c0654bd6112b488e64571cb39be02576aff9c32564e11c77c9bf742cef5f/ansicolors-1.1.7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4cb6e19f7e9ba61d140ed745936b406c", "sha256": "86eff1d0b2d28ac3e9195feb6a36850b519eefcfbf1f910651f03519ca1cc897" }, "downloads": -1, "filename": "ansicolors-1.1.7.zip", "has_sig": false, "md5_digest": "4cb6e19f7e9ba61d140ed745936b406c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21705, "upload_time": "2017-06-02T21:04:36", "url": "https://files.pythonhosted.org/packages/4f/e3/45e73f410b954145001be42cdf3661962353db8e6d31e4ca770d65bc68bd/ansicolors-1.1.7.zip" } ], "1.1.8": [ { "comment_text": "", "digests": { "md5": "f357aa02db2466bc24ff1815cff1aeb3", "sha256": "00d2dde5a675579325902536738dd27e4fac1fd68f773fe36c21044eb559e187" }, "downloads": -1, "filename": "ansicolors-1.1.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f357aa02db2466bc24ff1815cff1aeb3", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 13847, "upload_time": "2017-06-02T21:22:12", "url": "https://files.pythonhosted.org/packages/53/18/a56e2fe47b259bb52201093a3a9d4a32014f9d85071ad07e9d60600890ca/ansicolors-1.1.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ca7e2396ffa2e20af023c6b83ab7b14", "sha256": "99f94f5e3348a0bcd43c82e5fc4414013ccc19d70bd939ad71e0133ce9c372e0" }, "downloads": -1, "filename": "ansicolors-1.1.8.zip", "has_sig": false, "md5_digest": "9ca7e2396ffa2e20af023c6b83ab7b14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23027, "upload_time": "2017-06-02T21:22:10", "url": "https://files.pythonhosted.org/packages/76/31/7faed52088732704523c259e24c26ce6f2f33fbeff2ff59274560c27628e/ansicolors-1.1.8.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f357aa02db2466bc24ff1815cff1aeb3", "sha256": "00d2dde5a675579325902536738dd27e4fac1fd68f773fe36c21044eb559e187" }, "downloads": -1, "filename": "ansicolors-1.1.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f357aa02db2466bc24ff1815cff1aeb3", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 13847, "upload_time": "2017-06-02T21:22:12", "url": "https://files.pythonhosted.org/packages/53/18/a56e2fe47b259bb52201093a3a9d4a32014f9d85071ad07e9d60600890ca/ansicolors-1.1.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ca7e2396ffa2e20af023c6b83ab7b14", "sha256": "99f94f5e3348a0bcd43c82e5fc4414013ccc19d70bd939ad71e0133ce9c372e0" }, "downloads": -1, "filename": "ansicolors-1.1.8.zip", "has_sig": false, "md5_digest": "9ca7e2396ffa2e20af023c6b83ab7b14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23027, "upload_time": "2017-06-02T21:22:10", "url": "https://files.pythonhosted.org/packages/76/31/7faed52088732704523c259e24c26ce6f2f33fbeff2ff59274560c27628e/ansicolors-1.1.8.zip" } ] }