https://github.com/alan-turing-institute/distinctipy

A lightweight package for generating visually distinct colours.

https://github.com/alan-turing-institute/distinctipy

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
    Organization alan-turing-institute has institutional domain (turing.ac.uk)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary

Keywords

color-palette colour hut23 matplotlib python
Last synced: 7 months ago · JSON representation

Repository

A lightweight package for generating visually distinct colours.

Basic Info
Statistics
  • Stars: 271
  • Watchers: 6
  • Forks: 15
  • Open Issues: 13
  • Releases: 16
Topics
color-palette colour hut23 matplotlib python
Created almost 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

distinctipy logo

tests build codecov DOI Documentation Status

distinctipy is a lightweight python package providing functions to generate colours that are visually distinct from one another.

Commonly available qualitative colormaps provided by the likes of matplotlib generally have no more than 20 colours, but for some applications it is useful to have many more colours that are clearly different from one another. distinctipy can generate lists of colours of any length, with each new colour added to the list being as visually distinct from the pre-existing colours in the list as possible.

Installation

distinctipy is designed for Python 3 and can be installed with pip by running:

shell python -m pip install distinctipy

Alternatively clone the repo and install it locally:

shell git clone https://github.com/alan-turing-institute/distinctipy.git cd distinctipy python -m pip install .

Optional Dependencies

Starting in version 1.2.1 distinctipy no longer bundles matplotlib, pandas or dev dependencies in the default installation. If you wish to view colours (e.g. with distinctipy.color_swatch) or examples you will need matplotlib and pandas installed. To do this, either install distinctipy with the optional flag:

bash python -m pip install distinctipy[extras]

⚠️ Warning ⚠️ Previous versions of distinctipy (before 1.3) used [optional] instead of [extras].

Or install them separately:

bash python -m pip install matplotlib pandas

For developers, to install the stack needed to run tests, generate docs etc. use:

bash python -m pip install distinctipy[extras,tests,docs]

Usage and Examples

distinctipy can:

  • Generate N visually distinct colours: distinctipy.get_colors(N)
  • Generate colours that are distinct from an existing list of colours: distinctipy.get_colors(N, existing_colors)
  • Generate pastel colours: distinctipy.get_colors(N, pastel_factor=0.7)
  • Select black or white as the best font colour for any background colour: distinctipy.get_text_color(background_color)
  • Convert lists of colours into matplotlib colormaps: distinctipy.get_colormap(colors)
  • Invert colours: distinctipy.invert_colors(colors)
  • Nicely display generated colours: distinctipy.color_swatch(colors)
  • Compare distinctipy colours to other common colormaps: examples.compare_clusters() and examples.compare_colors()
  • Simulate how colours look for someone with colourblindness: colorblind.simulate_colors(colors, colorblind_type='Deuteranomaly')
  • Attempt to generate colours as distinct as possible for someone with colourblindness distinctipy.get_colors(N, existing_colors, colorblind_type="Deuteranomaly")

For example, to create and then display N = 36 visually distinct colours:

```python import distinctipy

number of colours to generate

N = 36

generate N visually distinct colours

colors = distinctipy.get_colors(N)

display the colours

distinctipy.color_swatch(colors) ```

More detailed usage and example output can be found in the notebook examples.ipynb and examples gallery.

References

distinctipy was heavily influenced and inspired by several web sources and stack overflow answers. In particular:

Citing distinctipy

If you would like to cite distinctipy, please refer to the upload of the package on Zenodo: https://doi.org/10.5281/zenodo.3985191

Owner

  • Name: The Alan Turing Institute
  • Login: alan-turing-institute
  • Kind: organization
  • Email: info@turing.ac.uk

The UK's national institute for data science and artificial intelligence.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 31
  • Issue comment event: 2
  • Push event: 1
  • Pull request event: 2
  • Fork event: 2
Last Year
  • Issues event: 1
  • Watch event: 31
  • Issue comment event: 2
  • Push event: 1
  • Pull request event: 2
  • Fork event: 2

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 129
  • Total Committers: 5
  • Avg Commits per committer: 25.8
  • Development Distribution Score (DDS): 0.147
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jack Roberts j****s@t****k 110
joncrall j****l@k****m 16
Yannick Brandt y****t@o****e 1
Marcelo Vinícius Cysneiros Aragão m****0@g****m 1
Kian-Meng Ang k****g@c****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 23
  • Total pull requests: 22
  • Average time to close issues: 7 months
  • Average time to close pull requests: 3 days
  • Total issue authors: 9
  • Total pull request authors: 7
  • Average comments per issue: 1.22
  • Average comments per pull request: 1.36
  • Merged pull requests: 18
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: 2 days
  • Average time to close pull requests: about 23 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jack89roberts (14)
  • Erol444 (2)
  • sinazadeh (1)
  • TheChymera (1)
  • Erotemic (1)
  • akhst7 (1)
  • Docetom (1)
  • bhavaygg (1)
  • abubelinha (1)
Pull Request Authors
  • jack89roberts (9)
  • Erotemic (5)
  • Erol444 (2)
  • dependabot[bot] (2)
  • marcelovca90 (2)
  • kianmeng (1)
  • coderesting (1)
Top Labels
Issue Labels
enhancement (6) code quality (5) documentation (4) question (2)
Pull Request Labels
dependencies (2)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 68,747 last-month
  • Total docker downloads: 3,246
  • Total dependent packages: 32
    (may contain duplicates)
  • Total dependent repositories: 39
    (may contain duplicates)
  • Total versions: 18
  • Total maintainers: 1
pypi.org: distinctipy

A lightweight package for generating visually distinct colours.

  • Homepage: https://github.com/alan-turing-institute/distinctipy
  • Documentation: https://distinctipy.readthedocs.io/
  • License: MIT License Copyright (c) 2019 The Alan Turing Institute Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 1.3.4
    published about 2 years ago
  • Versions: 17
  • Dependent Packages: 32
  • Dependent Repositories: 38
  • Downloads: 68,747 Last month
  • Docker Downloads: 3,246
Rankings
Dependent packages count: 0.5%
Downloads: 1.8%
Dependent repos count: 2.4%
Docker downloads count: 3.2%
Average: 3.8%
Stargazers count: 4.7%
Forks count: 10.2%
Maintainers (1)
Last synced: 7 months ago
conda-forge.org: distinctipy
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.4%
Stargazers count: 28.2%
Average: 37.3%
Forks count: 44.9%
Dependent packages count: 51.6%
Last synced: 7 months ago

Dependencies

.github/workflows/pythonapp.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • codecov/codecov-action v3 composite
.github/workflows/pythonpublish.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
pyproject.toml pypi
  • numpy >=1.16.3