{ "info": { "author": "Harshad Sharma", "author_email": "harshad@sharma.io", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: POSIX", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: BSD :: FreeBSD", "Operating System :: POSIX :: Linux", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development", "Topic :: Software Development :: User Interfaces", "Topic :: Terminals", "Topic :: Utilities" ], "description": "autopalette\n===========\n\nTerminal palettes and themes, without tears.\n\n::\n\n pip install autopalette\n\n**Status: Alpha; being developed.**\n\nDo you write python scripts that ``print()`` text on the command-line\nterminal? Do you feel the interface could convey a bit more meaning, but\nthe effort needed to get it right has kept you away from using ANSI\ncolors? These things should be easy, right?\n\nHere\u2019s a regular Python program that prints a word:\n\n.. code:: python\n\n print(\"Tring!\")\n\n.. figure:: https://user-images.githubusercontent.com/23116/40859649-0da89ab0-65d2-11e8-8026-19ba6a2ad003.png\n :alt: 01-regular-print\n\n 01-regular-print\n\nHere is what it looks like with autopalette, using a shortcut called\n``AutoFormat`` or in short: ``af``.\n\n.. code:: python\n\n from autopalette import af\n\n print(af(\"Tring!\"))\n\n.. figure:: https://user-images.githubusercontent.com/23116/40859706-3b61f3c0-65d2-11e8-996b-da4e218e192c.png\n :alt: 02-autoformat-wrapped-print\n\n 02-autoformat-wrapped-print\n\nWe added one line to import, and four characters around the string.\n\nAnd it does nothing - autopalette is non-intrusive that way. You can\nleave your ``af``-wrapped strings around and they will not run\nunnecessary code until you ask for more.\n\nWhat\u2019s more?\n\n.. code:: python\n\n from autopalette import af\n\n print(af(\"Hello, world!\").id)\n print(af(\"Hello, world!\").id256)\n\n.. figure:: https://user-images.githubusercontent.com/23116/40859765-63bec9b0-65d2-11e8-886c-82011ea96f8b.png\n :alt: 03-id-deterministic-color\n\n 03-id-deterministic-color\n\nIf your terminal / emulator reports that it supports color, you should\nsee the second line formatted in fuschia/ magenta. Try changing the text\nand observe that the color changes when the text changes, but it stays\nfixed for the same text. Across function calls, across program runs,\nacross machines, across time itself! Okay maybe that was too dramatic,\nbut it is kind of true because, mathematics.\n\nAutopalette\u2019s ``id`` feature hashes the supplied text and generates a\ncolor unique to the text within the range of colors reported by the\nterminal. ``id256`` generates a color within the ANSI 256 palette.\n``id256`` is not portable, but feel free to use it for your personal\nscripts where color limits are known.\n\nWhy is this useful?\n\nIt helps to identify unique names that your program may output, such as:\n\n- hostnames, when working with remote machines.\n- usernames, for logs of multi-user environments.\n- you know better what matters to your program\u2019s output :)\n\nSometimes you want a little more\u2026\n\n.. code:: python\n\n from autopalette import af\n\n print(af(\"Hello again!\").h1)\n\n.. figure:: https://user-images.githubusercontent.com/23116/40859801-858c3ef6-65d2-11e8-90d7-69a80fc57c57.png\n :alt: 04-header-one\n\n 04-header-one\n\nAnd we have a nicely decorated header, just like that. You can use one\nof the several pre-defined styles, or read further below how you can\ndesign your own.\n\nHere are the various styles built into autopalette.\n\n- ``p``: plain-text, or paragraph - as you like to read it.\n- ``light``: where color range allows it, lighter text.\n- ``dark``: darker text if terminal supports enough colors within\n palette.\n- ``h1``: highlighted text style 1, or header-1.\n- ``h2``:\n- ``h3``\n- ``h4``\n- ``li``: list element.\n- ``err``: an error\n- ``warn``: a warning\n- ``info``: a warning\n- ``ok``: a warning\n- ``b``: bold.\n- ``i``: italic.\n- ``u``: underline.\n- ``r``: reversed colors.\n- ``raw``: useful to debug, displays the ANSI code instead of applying\n it.\n\nLet us try superimposing two styles.\n\n.. code:: python\n\n from autopalette import af\n\n print(af(\"Hey! We've met before!?\").info.b)\n\n.. figure:: https://user-images.githubusercontent.com/23116/40859850-abe90afc-65d2-11e8-905d-d8a875d0f021.png\n :alt: 05-superimpose-styles\n\n 05-superimpose-styles\n\nYou get the idea, tack the names of styles you want at the end-bracket\nof the call to ``af``.\n\nIf you are wondering, \u201cWait, what\u2019s with that weird syntax?\u201d, in\nPython\u2019s spirit of quick protoyping, autopalette encourages\nexperimenting with minimal mental and physical effort to tweak knobs.\nYour program\u2019s actual task matters more, but you care enough about your\nfuture self and users using the app to style it well and be a delight to\nuse. Autopalette\u2019s syntax is an expriment to help manage this dilemma.\n\nWhile you compose and read your code, this syntax separates the styling\nfrom rest of the function calls. You don\u2019t have to think about styling\nunless you want to, and when you do, which is often as you look at the\nstring you just put together to print - assuming you started with\n``af(\"``, close the quote and bracket, type out a style shortcut and you\nare done.\n\nAlthough, few times you want a bit more than that\u2026\n\n.. code:: python\n\n from autopalette import af, GameBoyGreenPalette\n\n af.init(palette=GameBoyGreenPalette)\n\n print(af(\"There you are!\").h1)\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860027-550d2046-65d3-11e8-9fbe-b0ecdf3ec50c.png\n :alt: 06-select-palette\n\n 06-select-palette\n\nLook at that! Yummy.\n\nAutopalette goes the length to support a handful of palettes.\n\n- GameBoyChocolate\n- GameBoyOriginal\n- Grayscale\n- Oil\n- Arcade\n- CLRS\n\nIf this is exciting to you too, read further below how to create your\nown!\n\nHow does this look on a terminal with only 16 colors?\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860055-74e898aa-65d3-11e8-8bfc-3873c1ea4a4b.png\n :alt: 06-select-palette-16-color\n\n 06-select-palette-16-color\n\nNot too shabby, eh?\n\nHow do you test how your app will look on terminals with limited colors?\nTry these as prefix to your script invocation for a temporary change:\n\n- ``env TERM=vt100``\n- ``env TERM=rxvt``\n- ``env TERM=xterm``\n- ``env TERM=xterm-256color``\n- ``env COLORTERM=truecolor``\n- ``env NO_COLOR``\n\nlike so:\n\n``$ env TERM=xterm-256color python app.py``\n\nTo save a setting permanently, put ``export TERM=...`` in your\n``~/.bash_profile`` or your default shell\u2019s configuration.\n\nIf the environment variable NO_COLOR is set, autopalette honors the\nconfiguration and disables all color. Same with redirected output and\npipes - autopalette will handle it fully automatically, if it fails to\ndo so, please open an issue in the tracker and I\u2019ll do my best to fix\nit. In case you can fix the issue yourself, a pull request will be\nawesome!\n\nAnd we would be essentially done, except, there\u2019s this little voice in\nthe head that\u2019s saying something mojib\u00aake something, but it\u2019s all\ngarbled up.\n\n.. code:: python\n\n from autopalette import af \n\n af.init(fix_text=True)\n\n print(af(\"¯\\\\_(\u00e3\\x83\\x84)_/¯\").info)\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860106-abf343f4-65d3-11e8-9272-89733b0790bd.png\n :alt: 07-fix-text\n\n 07-fix-text\n\nNeat, with the ``fix_text`` option set, autopalette transparently passes\nyour text through ``ftfy``\\ \u2019s ``fix_text()`` function call, ensuring\nyour application does not output garbage when badly encoded strings find\ntheir way to your app\u2019s print statement.\n\nThere\u2019s more, not all terminal and emulators support unicode, and will\nstill produce garbage if we feed them strings that they do not know how\nto display. Use the ``fix_all`` option to let autopalette and the\nterminal it is running on figure out the rest.\n\n.. code:: python\n\n from autopalette import af \n\n af.init(fix_all=True)\n\n print(af(\"I \ud83d\udc9b Unicode!\"))\n\nTry this example with ``env TERM=vt100`` for the full cleanup!\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860125-c4f0343e-65d3-11e8-9bfe-d92f177c5852.png\n :alt: 08-fix-all\n\n 08-fix-all\n\nNote that fixing text and emoji requires additional libraries to be\nloaded and can slow down startup time. If your program does not output\nstrings generated by other programs, (which includes strings received\nfrom http APIs!) and the program is invoked repeatedly instead of\nrunning for a while, you may want to skip ``fix_...`` options.\n\nAnd that\u2019s about it for three-line examples!\n\nYou can start your scripts with ``af.init(fix_all=True)`` and use\n``af()`` to wrap your strings, even if you ignore colors and styles,\nyour program will display text correctly on most popular (and many\nobscure) terminals.\n\nHere\u2019s the basic theme:\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860445-e69d057a-65d4-11e8-9926-228beaf3c429.png\n :alt: 09-basic-palette\n\n 09-basic-palette\n\nBut there\u2019s more!\n\nYour users have the ability to define their own themes, and autopalette\nwill automatically\\* recolor your application to their preferences or\nneeds. (*mostly automatically, or with a little help.)\n\n.. code:: text\n\n # ~/.autopalette\n\n palette = Dutron\n render = Truecolor\n\n.. figure:: https://user-images.githubusercontent.com/23116/40860487-0589dd50-65d5-11e8-9360-2fb29a2d213e.png\n :alt: 10-restricted-color-palette\n\n 10-restricted-color-palette\n\nYour terminal applications look beautiful as you intend, to everyone, as\nthey expect.\n\nIt is almost two decades since Y2K! And with over 50 years of the\nterminal technology behind us, this should be a thing we expect as a\nnorm.\n\nAutopalette is another attempt at fixing some of these gaps by making it\nnear trivial to style terminal apps and do the right thing for the\nvarious terminals it runs on\u2026 without the complexity often involved as a\nresult of the rich legacy of the technology.\n\nAutopalette would not dare exist without the libraries published by\nthese generous individuals who made it possible to think and write code\nin simple mental models that are just right for the task:\n\n- ``colorhash``: Felix Krull (https://pypi.org/project/colorhash/)\n- ``colortrans.py``: Micah Elliott\n (https://gist.github.com/MicahElliott/719710/)\n- ``colour``: Valentin LAB (https://pypi.org/project/colour/)\n- ``emoji2text``: Sam CB (https://pypi.org/project/emoji2text/)\n- ``ftfy``: Rob Speer / Luminoso (https://pypi.org/project/ftfy/)\n- ``kdtree``: Stefan K\u00f6gl (https://pypi.org/project/kdtree/)\n- ``sty``: Felix Meyer-Wolters (https://pypi.org/project/sty/)\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hiway/autopalette", "keywords": "terminal,color,theme,palette", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "autopalette", "package_url": "https://pypi.org/project/autopalette/", "platform": "", "project_url": "https://pypi.org/project/autopalette/", "project_urls": { "Homepage": "https://github.com/hiway/autopalette" }, "release_url": "https://pypi.org/project/autopalette/0.1.0-2/", "requires_dist": [ "colorhash (>=1.0.2)", "colour (>=0.1.5)", "kdtree (>=0.16)", "sty (>=1.0.0b6)", "emoji2text", "ftfy" ], "requires_python": "", "summary": "Terminal palettes and themes, without tears.", "version": "0.1.0-2" }, "last_serial": 3931470, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5c02927c8ece884dad0a5369f8e0042b", "sha256": "8493d2f55d6a2d86515d89b352143fbb9a2eb70f072c425f657ff4915ba6c772" }, "downloads": -1, "filename": "autopalette-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5c02927c8ece884dad0a5369f8e0042b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18248, "upload_time": "2018-06-01T20:00:21", "url": "https://files.pythonhosted.org/packages/df/c4/afa134fc6f6533356fa86d548289c2bf15f8cd212b8676eda0bbf9b8fc32/autopalette-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13779f000f2c951de06c1505922f086a", "sha256": "e3453a58f2ae4444b84fdcfef463c5f3763411e85e40915c5a988cecc35b5279" }, "downloads": -1, "filename": "autopalette-0.1.0.tar.gz", "has_sig": false, "md5_digest": "13779f000f2c951de06c1505922f086a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23144, "upload_time": "2018-06-01T20:00:24", "url": "https://files.pythonhosted.org/packages/64/85/3d0d5b2563fd27482ac9edb4d05ee738e39f2fb7a9b63ad9391ce681c3fe/autopalette-0.1.0.tar.gz" } ], "0.1.0-1": [ { "comment_text": "", "digests": { "md5": "6c9e470b4af6b01433a548eec47f85fb", "sha256": "845d1ec37e66176fab0b4a4ca68d5a14218142f4ed43a4e8d63395e140d8a55d" }, "downloads": -1, "filename": "autopalette-0.1.0-1.tar.gz", "has_sig": false, "md5_digest": "6c9e470b4af6b01433a548eec47f85fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23185, "upload_time": "2018-06-02T06:31:41", "url": "https://files.pythonhosted.org/packages/7e/d1/a6efa0247161f6f1214e595c155d14bc156a41d1677876158d0d72f85a56/autopalette-0.1.0-1.tar.gz" }, { "comment_text": "", "digests": { "md5": "6734311f59f3ed5d7f66dc12d6ff3830", "sha256": "f3f1a35ee9b744331fcae0a1089b2bc04c6fed647fcecf5dc36a7fc5188f1445" }, "downloads": -1, "filename": "autopalette-0.1.0.post1-py3-none-any.whl", "has_sig": false, "md5_digest": "6734311f59f3ed5d7f66dc12d6ff3830", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18315, "upload_time": "2018-06-02T06:31:38", "url": "https://files.pythonhosted.org/packages/ce/2d/666c3394affb621443d07899cfc9666bbd0da916e9551fdc7121ced2913c/autopalette-0.1.0.post1-py3-none-any.whl" } ], "0.1.0-2": [ { "comment_text": "", "digests": { "md5": "2ec67f027677e675d7b247483d958298", "sha256": "60cc31bdcb8d1df54120c4deec5d5ead4200cdbb4fccbdaa5bae14cab896003e" }, "downloads": -1, "filename": "autopalette-0.1.0-2.tar.gz", "has_sig": false, "md5_digest": "2ec67f027677e675d7b247483d958298", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23212, "upload_time": "2018-06-05T09:28:55", "url": "https://files.pythonhosted.org/packages/6c/24/1d7f93eda8a0b21e55b1c072d404e1f4c81a73806c6ecd6f7c4e8c99bcfa/autopalette-0.1.0-2.tar.gz" }, { "comment_text": "", "digests": { "md5": "663380ae4e57d055450ab025aed90ae6", "sha256": "5892484b73f57c1ad21ea0d1069914cffbc06e490476400c56809f195cfe3bf9" }, "downloads": -1, "filename": "autopalette-0.1.0.post2-py3-none-any.whl", "has_sig": false, "md5_digest": "663380ae4e57d055450ab025aed90ae6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18335, "upload_time": "2018-06-05T09:28:53", "url": "https://files.pythonhosted.org/packages/cf/df/a28b029569cd796c7637a7763014e1fcdc557f3f4c90138eaf6001171d95/autopalette-0.1.0.post2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2ec67f027677e675d7b247483d958298", "sha256": "60cc31bdcb8d1df54120c4deec5d5ead4200cdbb4fccbdaa5bae14cab896003e" }, "downloads": -1, "filename": "autopalette-0.1.0-2.tar.gz", "has_sig": false, "md5_digest": "2ec67f027677e675d7b247483d958298", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23212, "upload_time": "2018-06-05T09:28:55", "url": "https://files.pythonhosted.org/packages/6c/24/1d7f93eda8a0b21e55b1c072d404e1f4c81a73806c6ecd6f7c4e8c99bcfa/autopalette-0.1.0-2.tar.gz" }, { "comment_text": "", "digests": { "md5": "663380ae4e57d055450ab025aed90ae6", "sha256": "5892484b73f57c1ad21ea0d1069914cffbc06e490476400c56809f195cfe3bf9" }, "downloads": -1, "filename": "autopalette-0.1.0.post2-py3-none-any.whl", "has_sig": false, "md5_digest": "663380ae4e57d055450ab025aed90ae6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18335, "upload_time": "2018-06-05T09:28:53", "url": "https://files.pythonhosted.org/packages/cf/df/a28b029569cd796c7637a7763014e1fcdc557f3f4c90138eaf6001171d95/autopalette-0.1.0.post2-py3-none-any.whl" } ] }