{ "info": { "author": "Marcelo V. Rozanti", "author_email": "mvrozanti@hotmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3 :: Only", "Topic :: Artistic Software" ], "description": "# colp \n[![Python versions](https://img.shields.io/pypi/pyversions/colp.svg)](https://pypi.org/project/colp/)\n[![PRs welcome](https://img.shields.io/badge/PRs-welcome-65F2F5.svg)](https://github.com/mvrozanti/colp#Contributing)\n[![Build Status](https://travis-ci.com/mvrozanti/colp.svg?token=Hrxne9dbhCC141HWAM1p&branch=master)](https://travis-ci.com/mvrozanti/colp)\n[![Coverage Status](https://coveralls.io/repos/github/mvrozanti/colp/badge.svg?branch=master)](https://coveralls.io/github/mvrozanti/colp?branch=master)\n[![PyPI](https://img.shields.io/pypi/v/colp.svg)](https://pypi.org/project/colp/)\n\nThe color processor \n\n\n![](https://i.imgur.com/WIAAZlR.png)\n\n\n### Objective\n\nThis tool is inspired on various processing tools such as awk, sed and imagemagick. There is no processing library for single color operations, be it interactively or not. \n`colp` attempts to solve that. It supports a number of color models (specified later in this README). The goal is to have the ability to script and automate any algorithmic color transformation.\n\n### Installation\n\n`pip install colp`\n\n### Example Usage\n\n#### Interactively operate on colors\n\n```\n$ colp 'a=RGB(1,1,1)' # optionally load a color to memory\n\n\u250c\u2500\u2510\u250c\u2500\u2510\u252c \u252c\u2500\u2510\n\u2502 \u2502 \u2502\u2502 \u2502\u2500\u2518\n\u2514\u2500\u2518\u2518\u2500\u2518\u2506\u2500\u2518\u2506 the color processor\n\n> a = a.redder() # single channel increment\n> a\nRGB(2, 1, 1)\n> a = a + 1 # all channels increment\n> a\nRGB(3, 2, 2)\n> lightgoldenrodyellow # X11/HTML constants\nRGB(250, 250, 210)\n> -a # inversion \nRGB(252, 253, 253)\n> red.rotate(180) == -red == cyan # rotate hue in HSV space\nTrue\n> skyblue ; skyblue.brighter() # brighter in HSV space\nRGB(135, 206, 235)\nRGB(136, 208, 237)\n\n> a_set_of_colors = [RGB(25,25,112), HSV(186,23,90), plum, orchid, fuchsia, HEX('#800080')]\n> sorted(a_set_of_colors)\n[RGB(25, 25, 112), HEX('#800080'), RGB(218, 112, 214), RGB(221, 160, 221), HSV(186, 23, 90), HEX('#ff00ff')]\n>\n> cursor = RGB(0,0,0) # define your own custom functions\n> def pop_and_turn(x):\n> if x: # equivalent to RGB(0,0,0) == 0\n> x = x.redder() * 255\n> return x.rotate(30)\n> \n> for i in range(10):\n> cursor = pop_and_turn(cursor)\n> print(cursor)\n>\nRGB(255, 0, 127)\nRGB(255, 0, 0)\nRGB(255, 127, 0)\nRGB(255, 255, 0)\nRGB(127, 255, 0)\nRGB(0, 255, 0)\nRGB(0, 255, 127)\nRGB(0, 255, 255)\nRGB(0, 127, 255)\nRGB(0, 0, 255)\n> red.interpolate(blue, 10) # interpolate between colors\n[HEX('#ff0000'), HEX('#e50019'), HEX('#cc0033'), HEX('#b2004c'), HEX('#990066'), HEX('#7f007f'), HEX('#660099'), HEX('#4c00b2'), HEX('#3300cc'), HEX('#1900e5'), HEX('#0000ff')]\n```\n\n#### Or pipe commands in\n\n```\n$ echo \"HEX('#ff0000').rotate(15.).to(RGB)\" | colp\n\nRGB(255, 63, 0)\n\n```\n\n#### Usage from Python script\n\n```\nfrom colp import *\nprint(RGB(1,2,3).to(HEX))\n\n```\n\noutputs:\n\n```\nHEX('#010203')\n```\n\n### Class Hierarchy\n```\nColor\n\u251c\u2500\u2500 RGB\n\u2502 \u251c\u2500\u2500 HEX\n\u2502 \u2514\u2500\u2500 CMYK\n\u251c\u2500\u2500 YIQ\n\u2502 \u251c\u2500\u2500 YUV \n\u2502 \u251c\u2500\u2500 YPbPr\n\u2502 \u251c\u2500\u2500 YDbDr\n\u2502 \u2514\u2500\u2500 YCbCr\n\u2502 \u2514\u2500\u2500 xvYCC\n\u251c\u2500\u2500 CIE\n\u2502 \u251c\u2500\u2500 CIELAB\n\u2502 \u251c\u2500\u2500 CIELCh\n\u2502 \u251c\u2500\u2500 CIEUVW\n\u2502 \u2514\u2500\u2500 CIEXYZ\n\u2514\u2500\u2500 HSV = HSD = HSB = HSI\n \u2514\u2500\u2500 HSL\n```\n\n\n### Formal Parameters\n\n```\nusage: colp [-h] [-n] [-v] [-c] [-s] [-l SCRIPT_FILE] [VAR [VAR ...]]\n\nColor Processor\n\npositional arguments:\n VAR arbitrary python code execution\n\noptional arguments:\n -h, --help show this help message and exit\n -n, --no-banner don't show banner on interactive mode\n -v, --visualizer visualize current color processed\n -c, --css-mode css-compliant output\n -s, --scripting-mode colp script output, which can be reinterpreted by colp\n -l SCRIPT_FILE, --load-script SCRIPT_FILE\n load script from file or stdin\n```\n\n### Basic Color Operators\n| | | | |\n|----|----|----|-----|\n|`-` |`+` |`*` |`/` |\n|`//`|`~` |`^` |`\\|` |\n|`&` |`**`|`%` |`>>` | \n|`<<`|`<` |`>` |`<=` |\n|`>=`|`==`|`is`|`not`|\n\n### Named Constants (140)\n- [HTML 4.01 specification](https://en.wikipedia.org/wiki/Web_colors#HTML_color_names)\n- [X11 color names](https://en.wikipedia.org/wiki/Web_colors#)\n\n### Good Resources\n- [HSV Color Specification](https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/hsv.html)\n- [Color Models vs Color Spaces](https://programmingdesignsystems.com/color/color-models-and-color-spaces/index.html)\n- [rapidtables.com color converter (including formulas)](https://www.rapidtables.com/convert/color/index.html)\n- [colormath-basics](http://www.laurenscorijn.com/articles/colormath-basics)\n\n\n### Supported Color Models\n\n| | |\n|----------------------|----------------------|\n| \u2713 RGB/RGBA/HEX: | \u2713 HSV=HSB=HSI=HSD: |\n|\"drawing\"|\"drawing\"|\n| HSL: | CMY[K]: |\n|\"drawing\"|\"drawing\"|\n| [CIE]LAB: | YCbCr: |\n| \"drawing\"|\"drawing\"|\n| YIQ: | YUV: |\n|\"drawing\"|\"drawing\"|\n\n### Contributing\n\nThere are many other useful colorspaces to convert to and only some are listed in this README.\nTo cover a new colorspace, just add a class that extends `Color` or, even better, a `Color` subclass.\nThere's also definitely some room for automating CSS-file editing.\n\nPull requests are welcomed!\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/mvrozanti/colp", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "colp", "package_url": "https://pypi.org/project/colp/", "platform": "", "project_url": "https://pypi.org/project/colp/", "project_urls": { "Homepage": "https://github.com/mvrozanti/colp" }, "release_url": "https://pypi.org/project/colp/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Color Processor", "version": "0.0.2" }, "last_serial": 5495920, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2446f67b2bf99b6dc1722369986152f9", "sha256": "62e712c580257a07083b31c82b28738e7cefbb44d73af281128c82123f3469f5" }, "downloads": -1, "filename": "colp-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2446f67b2bf99b6dc1722369986152f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14418, "upload_time": "2019-07-04T02:14:46", "url": "https://files.pythonhosted.org/packages/76/14/790389d4b5ea0e25842a494c42f71b10f688ed101e8719be072989c34f3a/colp-0.0.1-py3-none-any.whl" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4aca5552fbc241a2190926cb7b5396f9", "sha256": "9ed4759d8969bc0e68a502bce4a1895c32b2935a5b27575a54de57e2465b06a9" }, "downloads": -1, "filename": "colp-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4aca5552fbc241a2190926cb7b5396f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15462, "upload_time": "2019-07-07T00:37:37", "url": "https://files.pythonhosted.org/packages/59/98/1503a25bcc9fc13cca59cd6ebc593651e74f251b680a47da82ba37e54c83/colp-0.0.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4aca5552fbc241a2190926cb7b5396f9", "sha256": "9ed4759d8969bc0e68a502bce4a1895c32b2935a5b27575a54de57e2465b06a9" }, "downloads": -1, "filename": "colp-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4aca5552fbc241a2190926cb7b5396f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15462, "upload_time": "2019-07-07T00:37:37", "url": "https://files.pythonhosted.org/packages/59/98/1503a25bcc9fc13cca59cd6ebc593651e74f251b680a47da82ba37e54c83/colp-0.0.2-py3-none-any.whl" } ] }