{"id":16355492,"url":"https://github.com/waveform80/colorzero","last_synced_at":"2025-05-07T09:45:04.047Z","repository":{"id":53758031,"uuid":"70318141","full_name":"waveform80/colorzero","owner":"waveform80","description":"Another color manipulation library for Python (originally from picamera)","archived":false,"fork":false,"pushed_at":"2021-11-14T23:08:55.000Z","size":296,"stargazers_count":25,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T20:50:50.930Z","etag":null,"topics":["color","python"],"latest_commit_sha":null,"homepage":"https://colorzero.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waveform80.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-08T08:52:54.000Z","updated_at":"2024-08-07T18:09:10.000Z","dependencies_parsed_at":"2022-09-10T03:03:23.298Z","dependency_job_id":null,"html_url":"https://github.com/waveform80/colorzero","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcolorzero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcolorzero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcolorzero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waveform80%2Fcolorzero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waveform80","download_url":"https://codeload.github.com/waveform80/colorzero/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252853696,"owners_count":21814561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["color","python"],"created_at":"2024-10-11T01:40:58.556Z","updated_at":"2025-05-07T09:45:04.025Z","avatar_url":"https://github.com/waveform80.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. -*- rst -*-\n\n=========\ncolorzero\n=========\n\ncolorzero is a color manipulation library for Python (yes, *another* one) which\naims to be reasonably simple to use and \"pythonic\" in nature.\n\nIt does *not* aim to be as comprehensive, powerful, or that matter as *correct*\nas, say, `colormath`_.  colorzero originally grew out of work on my `picamera`_\nproject, hence it's intended to be sufficiently simple that school children can\nuse it without having to explain color spaces and illuminants. However, it does\naim to be useful to a wide range of skills, hence it does include basic\nfacilities for `CIE Lab`_ representations, and `Delta-E`_ calculations should\nyou need them.\n\nThe major difference between colorzero and other libraries (`grapefruit`_,\n`colormath`_, etc.) is that its ``Color`` class is a ``namedtuple`` descendent.\nThis means it is immutable; you cannot *directly* change the attributes of a\n``Color`` instance. The major advantage of this is that instances can be used\nas keys in dictionaries (for simple `LUTs`_), or placed in sets.\n\nManipulation of ``Color`` instances is done by typical operations with other\nclasses the result of which is a new ``Color`` instance. For example:\n\n.. code:: pycon\n\n    \u003e\u003e\u003e from colorzero import *\n    \u003e\u003e\u003e Color('red') + Color('blue')\n    \u003cColor html='#ff00ff' rgb=(1, 0, 1)\u003e\n    \u003e\u003e\u003e Color('magenta') - Color('red')\n    \u003cColor html='#0000ff' rgb=(0, 0, 1)\u003e\n    \u003e\u003e\u003e Color('red') - Red(0.5)\n    \u003cColor html='#800000' rgb=(0.5, 0, 0)\u003e\n    \u003e\u003e\u003e Color('green') + Color('grey').red\n    \u003cColor html='#808000' rgb=(0.501961, 0.501961, 0)\u003e\n    \u003e\u003e\u003e Color.from_hls(0.5, 0.5, 1.0)\n    \u003cColor html='#00ffff' rgb=(0, 1, 1)\u003e\n    \u003e\u003e\u003e Color.from_hls(0.5, 0.5, 1.0) * Lightness(0.8)\n    \u003cColor html='#00cccc' rgb=(0, 0.8, 0.8)\u003e\n    \u003e\u003e\u003e (Color.from_hls(0.5, 0.5, 1.0) * Lightness(0.8)).hls\n    HLS(h=0.5, l=0.4, s=1.0)\n\nAnother interesting facility is the custom format strings that ``Color``\ninstances support, making them convenient for direct use in HTML or CSS\ntemplating:\n\n.. code:: pycon\n\n    \u003e\u003e\u003e red = Color('red')\n    \u003e\u003e\u003e black = Color('black')\n    \u003e\u003e\u003e stylesheet = f\"\"\"\\\n    .warning {{ color: {red:css}; }}\n    .table {{ border: 1px solid {black:html}; }}\n    \"\"\"\n    \u003e\u003e\u003e print(stylesheet)\n    .warning { color: rgb(255, 0, 0); }\n    .table { border: 1px solid #000000; }\n\nOr for in colorful terminal output:\n\n.. code:: pycon\n\n    \u003e\u003e\u003e print(f'This is a {red:8}warning!{Default}')\n    This is a warning!\n    \u003e\u003e\u003e f'This is a {red:8}warning!{Default}'\n    'This is a \\x1b[1;31mwarning!\\x1b[0m'\n\n(on supported terminals, the first line of output above will print \"warning!\"\nin red)\n\n\nLinks\n=====\n\n* The code is licensed under the `BSD license`_\n* The `source code`_ can be obtained from GitHub, which also hosts the `bug\n  tracker`_\n* The `documentation`_ (which includes installation, quick-start examples, and\n  lots of code recipes) can be read on ReadTheDocs\n* Packages can be downloaded from `PyPI`_, but reading the installation\n  instructions is more likely to be useful\n\n\n.. _picamera: https://picamera.readthedocs.io/\n.. _colormath: https://python-colormath.readthedocs.io/\n.. _grapefruit: https://grapefruit.readthedocs.io/\n.. _CIE Lab: https://en.wikipedia.org/wiki/Lab_color_space\n.. _Delta-E: https://en.wikipedia.org/wiki/Color_difference\n.. _PyPI: http://pypi.python.org/pypi/colorzero/\n.. _documentation: http://colorzero.readthedocs.io/\n.. _source code: https://github.com/waveform80/colorzero\n.. _bug tracker: https://github.com/waveform80/colorzero/issues\n.. _BSD license: http://opensource.org/licenses/BSD-3-Clause\n.. _LUTs: https://en.wikipedia.org/wiki/Lookup_table#Lookup_tables_in_image_processing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaveform80%2Fcolorzero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaveform80%2Fcolorzero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaveform80%2Fcolorzero/lists"}