{ "info": { "author": "Barry Scott", "author_email": "barry@barrys-emacs.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "# colour_text\n\n# colour_text and colour-print command\n\n`colour-print` is a command that makes printing coloured text\neasier to do on Unix, macOS and Windows. It uses the `ColourText`\nclass to colour the text.\n\nThe command uses markup using `<>colour-name text<>`.\n\n``` bash\n $ colour-print \"<>info Info:<> this is an <>em informational<> message\"\n $ colour-print \"<>error Error: This is an error message<>\"\n```\n\nThe first argument is treated as a format string if there are more arguments.\n\n``` bash\n $ colour-print \"<>info Info:<> Home folder is %s\" \"$HOME\"\n```\n\n![screenshot of help output](https://raw.githubusercontent.com/barry-scott/CLI-tools/master/Source/colour_text/colour-print-help.png)\n\n# class ColourText\n\nThe `ColourText` class converts strings with colour markup into\na form suitable for printing on a terminal that support colour\ntext. This include most terminal emulators on macOS, Windows\nand Unix.\n\nTo colour a section of text use the marker followed by the colour\nname a space and the text to be coloured ending with the marker.\n\n``` python\n from colour_text import ColourText\n\n ct = ColourText()\n ct.initTerminal()\n\n print( ct.convert( \"The next section is in green: <>green example<>.\" ) )\n```\n\nTo include the marker as literal text use two adjacent markers.\n\n``` python\n from colour_text import ColourText\n\n ct = ColourText()\n ct.initTerminal()\n\n print( ct(\"A <>red literal marker<> <><> in the string\") )\n```\n\nColoutText can be use with gettext for internationalized applications.\n\n``` python\n\n from colour_text import ColourText\n\n ct = ColourText()\n ct.initTerminal()\n\n message = \"<>red Error: cannot open file %s<>\"\n i18n_message = _(message)\n coloured_i18n_message = ct(i18n_message)\n formatted_message = coloured_i18n_message % (file_name,)\n\n print( formatted_message )\n\n # or in one line\n print ct( _(\"<>red Error: cannot open file %s<>\") ) % (file_name,) )\n```\n\nclass ColourText\n\n- `__init__( marker='<>' )`\n\n The `marker` is the string used to markup the colour sections\n which defaults to `<>`.\n\n- `initTerminal()`\n\n Ensure the terminal can display coloured text.\n\n Must be called on Windows and can be safely called on macOS and Unix systems.\n\n- `define( name, colour_def )`\n\n Define a colour `name` for use in the marked up sections.\n The `colour_def` is a list of existing colour names\n or a single name.\n\n The builtin foreground colour names are:\n\n bold, black, brown, green, yellow, blue,\n magenta, cyan, gray, red, lightred, lightgreen,\n lightyellow, lightblue, lightmagenta, lightcyan\n and white.\n\n The builtin background colour names are:\n\n bg-black, bg-brown, bg-green, bg-yellow,\n bg-blue, bg-magenta, bg-cyan, bg-gray\n and bg-white.\n\n For example add the name `info` as green text and `error` as\n to be red text on a white background:\n\n``` python\n ct = ColourText()\n ct.define( 'info', 'green' )\n ct.define( 'error', ('red', 'bg-white') )\n\n ct( \"Error messages are <>error shown like this<>\" ) \n```\n\n- `convert( colour_text )`\n\n Interpret the colour markup in the colour_text string\n and return a string suitable for printing on the terminal.\n\n- `__call__( colour_text )`\n\n Call `convert( colour_text )` in a concise way.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/barry-scott/CLI-tools", "keywords": "development", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "colour-text", "package_url": "https://pypi.org/project/colour-text/", "platform": "", "project_url": "https://pypi.org/project/colour-text/", "project_urls": { "Homepage": "https://github.com/barry-scott/CLI-tools" }, "release_url": "https://pypi.org/project/colour-text/1.0.4/", "requires_dist": null, "requires_python": "", "summary": "Colour Print", "version": "1.0.4", "yanked": false, "yanked_reason": null }, "last_serial": 6009157, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "5c4e69f08527a43b85efae09fe56850c", "sha256": "bc507929f82004cd3a42d607ff4ccaa1cfee3a3d2ab7569e1dbe63501c41d4f8" }, "downloads": -1, "filename": "colour_text-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5c4e69f08527a43b85efae09fe56850c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4857, "upload_time": "2019-08-11T14:09:29", "upload_time_iso_8601": "2019-08-11T14:09:29.278092Z", "url": "https://files.pythonhosted.org/packages/44/44/19565efe2eaab28d05c9fd7a3dca2c528a0e0d60f006e5d0e3b4074f18a8/colour_text-1.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "d66cecab9843bca761c5c25bb5d4c260", "sha256": "3bbd16faaab35abbb8c0728460c492af2b0161d7fc0729e6ffc129e3e310bbc8" }, "downloads": -1, "filename": "colour-text-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d66cecab9843bca761c5c25bb5d4c260", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4822, "upload_time": "2019-08-11T14:09:37", "upload_time_iso_8601": "2019-08-11T14:09:37.252727Z", "url": "https://files.pythonhosted.org/packages/3c/3c/f6f3bda0897f12bd5c042818d7664b1966f23493fc57cd5f8394208df7ef/colour-text-1.0.0.tar.gz", "yanked": false, "yanked_reason": null } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "68b255a0d45729155bb6f10423f1b068", "sha256": "30ca2fc69433efbd3624369dda2b979d62bc306ce1c9ef11b5f16ad7c613de8a" }, "downloads": -1, "filename": "colour_text-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "68b255a0d45729155bb6f10423f1b068", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5761, "upload_time": "2019-08-14T07:55:50", "upload_time_iso_8601": "2019-08-14T07:55:50.031218Z", "url": "https://files.pythonhosted.org/packages/78/fe/45b343367ff5224063222ea2c9ad60c4c816d0143237f04ba420703c8a99/colour_text-1.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "2db2beade03d0f45492c331976e49276", "sha256": "f547f5c2c06506360da3adcb999bb9831623b037a4ac98b75a9cc13c32a778f2" }, "downloads": -1, "filename": "colour-text-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2db2beade03d0f45492c331976e49276", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5504, "upload_time": "2019-08-14T07:55:51", "upload_time_iso_8601": "2019-08-14T07:55:51.538784Z", "url": "https://files.pythonhosted.org/packages/f5/5e/9d96ea9809fbfa5e5754bab4d95bea10b187158a9fd44531b4dd844a1d33/colour-text-1.0.1.tar.gz", "yanked": false, "yanked_reason": null } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "905f22bbd91f0be0e08bb55c2adf0d58", "sha256": "5b72d70011146e32de39675b2f7b9c86116aff6132ed7de0a48d2e868e7fb595" }, "downloads": -1, "filename": "colour_text-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "905f22bbd91f0be0e08bb55c2adf0d58", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5987, "upload_time": "2019-08-16T11:53:40", "upload_time_iso_8601": "2019-08-16T11:53:40.355987Z", "url": "https://files.pythonhosted.org/packages/be/6a/adfe84a39b37d46091566733748f6c6a4fd4ab3bcc7142b08dadfde3367e/colour_text-1.0.2-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "499034df4f8e6803888532927650db8a", "sha256": "1e32d7afcc13d33f9e1a088219033f26a2f507060903bf12ac0f99928e90aa0f" }, "downloads": -1, "filename": "colour-text-1.0.2.tar.gz", "has_sig": false, "md5_digest": "499034df4f8e6803888532927650db8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5726, "upload_time": "2019-08-16T11:53:46", "upload_time_iso_8601": "2019-08-16T11:53:46.653539Z", "url": "https://files.pythonhosted.org/packages/13/e5/063ab8dba212c7914a1536b829cfe376666a0ae5496773962bb5e4a39f13/colour-text-1.0.2.tar.gz", "yanked": false, "yanked_reason": null } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "dee95a3c60604cc5eb331d91230a1a8a", "sha256": "e66e2da658e350946e68a37df3fa68cd91bf0e7dc16195326a18b9eb07757420" }, "downloads": -1, "filename": "colour_text-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dee95a3c60604cc5eb331d91230a1a8a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5819, "upload_time": "2019-09-28T16:54:01", "upload_time_iso_8601": "2019-09-28T16:54:01.021142Z", "url": "https://files.pythonhosted.org/packages/e2/38/9202c756ff5f499923d50864f0ceb07bcfba813b8e113327d649f4314f62/colour_text-1.0.3-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "8d0ec77ca13d8258bc435eb0ad0227f6", "sha256": "509f21bd97a0e6ca95b152553ecc34906044f0861438a71a82f678438560fd6f" }, "downloads": -1, "filename": "colour_text-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d0ec77ca13d8258bc435eb0ad0227f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5823, "upload_time": "2019-10-21T20:20:49", "upload_time_iso_8601": "2019-10-21T20:20:49.705389Z", "url": "https://files.pythonhosted.org/packages/50/c8/df9941d5f83ac91a69745d12f6bd8d9da50810e6beef9331286ae4f302ae/colour_text-1.0.4-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d0ec77ca13d8258bc435eb0ad0227f6", "sha256": "509f21bd97a0e6ca95b152553ecc34906044f0861438a71a82f678438560fd6f" }, "downloads": -1, "filename": "colour_text-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d0ec77ca13d8258bc435eb0ad0227f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5823, "upload_time": "2019-10-21T20:20:49", "upload_time_iso_8601": "2019-10-21T20:20:49.705389Z", "url": "https://files.pythonhosted.org/packages/50/c8/df9941d5f83ac91a69745d12f6bd8d9da50810e6beef9331286ae4f302ae/colour_text-1.0.4-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }