{"id":13478305,"url":"https://github.com/alan-turing-institute/distinctipy","last_synced_at":"2025-05-15T06:06:35.330Z","repository":{"id":43264326,"uuid":"188444660","full_name":"alan-turing-institute/distinctipy","owner":"alan-turing-institute","description":"A lightweight package for generating visually distinct colours.","archived":false,"fork":false,"pushed_at":"2025-01-05T20:51:36.000Z","size":13594,"stargazers_count":264,"open_issues_count":13,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T10:42:37.037Z","etag":null,"topics":["color-palette","colour","hut23","matplotlib","python"],"latest_commit_sha":null,"homepage":"https://distinctipy.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alan-turing-institute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-24T15:20:34.000Z","updated_at":"2025-03-29T17:12:25.000Z","dependencies_parsed_at":"2025-03-09T22:35:19.263Z","dependency_job_id":null,"html_url":"https://github.com/alan-turing-institute/distinctipy","commit_stats":{"total_commits":128,"total_committers":4,"mean_commits":32.0,"dds":0.140625,"last_synced_commit":"12504d1d24254e4ac9d88b8ccdd4648a4c39e9a5"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2Fdistinctipy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2Fdistinctipy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2Fdistinctipy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alan-turing-institute%2Fdistinctipy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alan-turing-institute","download_url":"https://codeload.github.com/alan-turing-institute/distinctipy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283300,"owners_count":22045136,"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-palette","colour","hut23","matplotlib","python"],"created_at":"2024-07-31T16:01:55.315Z","updated_at":"2025-05-15T06:06:30.320Z","avatar_url":"https://github.com/alan-turing-institute.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![distinctipy logo](https://raw.githubusercontent.com/alan-turing-institute/distinctipy/main/distinctipy_logo.png)\n\n[![tests](https://github.com/alan-turing-institute/distinctipy/actions/workflows/pythonapp.yml/badge.svg)](https://github.com/alan-turing-institute/distinctipy/actions/workflows/pythonapp.yml)\n[![build](https://github.com/alan-turing-institute/distinctipy/actions/workflows/pythonpublish.yml/badge.svg)](https://github.com/alan-turing-institute/distinctipy/actions/workflows/pythonpublish.yml)\n[![codecov](https://codecov.io/gh/alan-turing-institute/distinctipy/branch/main/graph/badge.svg)](https://codecov.io/gh/alan-turing-institute/distinctipy)\n[![DOI](https://zenodo.org/badge/188444660.svg)](https://zenodo.org/badge/latestdoi/188444660)\n[![Documentation Status](https://readthedocs.org/projects/distinctipy/badge/?version=latest)](https://distinctipy.readthedocs.io/en/latest/?badge=latest)\n\n_distinctipy_ is a lightweight python package providing functions to generate\ncolours that are visually distinct from one another.\n\nCommonly available qualitative colormaps provided by the likes of matplotlib\ngenerally have no more than 20 colours, but for some applications it is useful\nto have many more colours that are clearly different from one another.\n_distinctipy_ can generate lists of colours of any length, with each new colour\nadded to the list being as visually distinct from the pre-existing colours in\nthe list as possible.\n\n## Installation\n\n_distinctipy_ is designed for Python 3 and can be installed with pip by running:\n\n```shell\npython -m pip install distinctipy\n```\n\nAlternatively clone the repo and install it locally:\n\n```shell\ngit clone https://github.com/alan-turing-institute/distinctipy.git\ncd distinctipy\npython -m pip install .\n```\n\n### Optional Dependencies\n\nStarting in version 1.2.1 `distinctipy` no longer bundles `matplotlib`, `pandas` or dev dependencies in the default installation. If you wish to view\ncolours (e.g. with `distinctipy.color_swatch`) or examples you will need `matplotlib` and `pandas` installed. To do this, either install `distinctipy`\nwith the optional flag:\n\n```bash\npython -m pip install distinctipy[extras]\n```\n\n⚠️ Warning ⚠️ Previous versions of distinctipy (before 1.3) used `[optional]` instead of `[extras]`.\n\nOr install them separately:\n\n```bash\npython -m pip install matplotlib pandas\n```\n\nFor developers, to install the stack needed to run tests, generate docs etc. use:\n\n```bash\npython -m pip install distinctipy[extras,tests,docs]\n```\n\n## Usage and Examples\n\n_distinctipy_ can:\n\n- Generate N visually distinct colours: `distinctipy.get_colors(N)`\n- Generate colours that are distinct from an existing list of colours: `distinctipy.get_colors(N, existing_colors)`\n- Generate pastel colours: `distinctipy.get_colors(N, pastel_factor=0.7)`\n- Select black or white as the best font colour for any background colour: `distinctipy.get_text_color(background_color)`\n- Convert lists of colours into matplotlib colormaps: `distinctipy.get_colormap(colors)`\n- Invert colours: `distinctipy.invert_colors(colors)`\n- Nicely display generated colours: `distinctipy.color_swatch(colors)`\n- Compare distinctipy colours to other common colormaps: `examples.compare_clusters()` and `examples.compare_colors()`\n- Simulate how colours look for someone with colourblindness: `colorblind.simulate_colors(colors, colorblind_type='Deuteranomaly')`\n- Attempt to generate colours as distinct as possible for someone with colourblindness `distinctipy.get_colors(N, existing_colors, colorblind_type=\"Deuteranomaly\")`\n\nFor example, to create and then display N = 36 visually distinct colours:\n\n```python\nimport distinctipy\n\n# number of colours to generate\nN = 36\n\n# generate N visually distinct colours\ncolors = distinctipy.get_colors(N)\n\n# display the colours\ndistinctipy.color_swatch(colors)\n```\n\nMore detailed usage and example output can be found in the notebook **[examples.ipynb](https://github.com/alan-turing-institute/distinctipy/blob/main/examples.ipynb)** and **[examples gallery](https://github.com/alan-turing-institute/distinctipy/tree/main/examples)**.\n\n## References\n\n_distinctipy_ was heavily influenced and inspired by several web sources and\nstack overflow answers. In particular:\n\n- **Random generation of distinct colours:** [Andrew Dewes on GitHub](https://gist.github.com/adewes/5884820)\n- **Colour distance metric:** [Thiadmer Riemersma at CompuPhase](https://www.compuphase.com/cmetric.htm)\n- **Best text colour for background:** [Mark Ransom on Stack Overflow](https://stackoverflow.com/a/3943023)\n- **Colourblindness Filters:** [Matthew Wickline and the Human-Computer Interaction Resource Network](http://web.archive.org/web/20090318054431/http://www.nofunc.com/Color_Blindness_Library) (web archive)\n\n## Citing distinctipy\n\nIf you would like to cite distinctipy, please refer to the upload of the package on Zenodo: https://doi.org/10.5281/zenodo.3985191\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falan-turing-institute%2Fdistinctipy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falan-turing-institute%2Fdistinctipy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falan-turing-institute%2Fdistinctipy/lists"}