# Color-Craftsman
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)
![Development Status](https://img.shields.io/badge/development-active-brightgreen.svg)
![PyPI Downloads](https://img.shields.io/pypi/dm/color-craftsman.svg)
## Description
Color-Craftsman creates perceptually-distinct color palettes for data visualization in Python. While many great plotting libaries exist, they often rely on fixed color palettes and generally have few colors. These colors often conflict with one another. Color-Craftsman allows users to create a palette of colors that are perceptually distinct from one another. This allows for more colors to be used in a plot without sacrificing readability.
## Installation
```bash
pip install color-craftsman
```
## Usage
Simple examples are shown below. For more examples, see the [examples](./examples) directory.
### Creating a Random Palette
```python
import color_craftsman as cc
# Create a palette with 5 colors
palette = cc.generate_palette(
5,
min_dist=30,
seed=11,
output_format="rgb",
)
cc.visualize_palette(palette, show=True)
```
![base_palette](./images/base_palette.png)
`Note:` a random seed can be provided to ensure reproducibility. Distance is the distance between colors in the palette. A larger distance will result in more distinct colors. If the distance is too large, a warning message will be displayed. Too large of distances can result in colors that are too similar to each other due to clipping in the RGB color space. Distance is defined as the Delta-E color difference between colors in the palette.
### Creating a Palette from a Base Palette
```python
import color_craftsman as cc
# Create a palette with 10 total colors
extended_palette = cc.extend_palette(
[
np.array([153, 191, 80]),
np.array([107, 88, 11]),
np.array([42, 19, 119]),
np.array([93, 110, 244]),
np.array([213, 114, 236]),
],
10,
min_dist=10,
seed=18,
palette_format="rgb",
output_format="rgb",
)
cc.visualize_palette(extended_palette, show=True)
```
![extended_palette](./images/extended_palette.png)
### Visualizing a Palette
```python
import color_craftsman as cc
cc.visualize_palette(palette, show=True)
```
### Colorblind-Safe Palettes
To guard against deutranopia, protanopia, and tritanopia, use the `colorblind_safe` parameter.
```python
palette = cc.generate_palette(
5,
min_dist=30,
seed=22,
output_format="rgb",
colorblind_safe=True,
)
cc.visualize_palette(extended_palette, show=True)
```
![colorblind_palette](./images/colorblind_safe_palette.png)
#### Specific Colorblindness-Safe Palettes
If you want to guard against specific-forms of colorblindness, you can specify the type of colorblindness using the following arguments: `deuteranomaly_safe`, `protanomaly_safe`, and `tritanomaly_safe`.
##### Deuteranopia-Safe Palette
```python
palette = cc.generate_palette(
5,
min_dist=30,
seed=33,
output_format="rgb",
deuteranomaly_safe=True,
)
cc.visualize_palette(palette, show=True)
```
![deuteranomaly_palette](./images/deuteranopia_safe_palette.png)
##### Protanopia-Safe Palette
```python
palette = cc.generate_palette(
5,
min_dist=30,
seed=44,
output_format="rgb",
protanomaly_safe=True,
)
cc.visualize_palette(palette, show=True)
```
![protanopia_palette](./images/protanopia_safe_palette.png)
##### Tritanopia-Safe Palette
```python
palette = cc.generate_palette(
5,
min_dist=30,
seed=55,
output_format="rgb",
tritanomaly_safe=True,
)
cc.visualize_palette(palette, show=True)
```
![tritanopia_palette](./images/tritanopia_safe_palette.png)
## Contributing
Contributions are welcome! If you'd like to contribute to the project, please follow these guidelines:
1. Fork the repository.
2. Create a new branch.
3. Make your changes.
4. Test your changes thoroughly.
5. Submit a pull request.
6. Add caharper as a reviewer.
Please ensure your code adheres to the project's coding style and conventions.
## License
This project is licensed under the [MIT License](LICENSE).
## Contact
If you have any questions, suggestions, or feedback, feel free to reach out:
- Email: [caharper@smu.edu](mailto:caharper@smu.edu)
- GitHub: [caharper](https://github.com/caharper)
Raw data
{
"_id": null,
"home_page": "https://github.com/caharper/color-craftsman",
"name": "color-craftsman",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "data visualization,color palette,perceptual distinctiveness,color-blind safe,visualization tools,python,color theory,accessible visualizations",
"author": "Clay Harper",
"author_email": "caharper@smu.edu",
"download_url": "https://files.pythonhosted.org/packages/38/ec/cab0bbb0171e852fd3e07a62dee3dd98b9c5f20b8d1f88e7bb467e8e6814/color_craftsman-0.1.0.tar.gz",
"platform": null,
"description": "# Color-Craftsman\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)\n[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)\n![Development Status](https://img.shields.io/badge/development-active-brightgreen.svg)\n![PyPI Downloads](https://img.shields.io/pypi/dm/color-craftsman.svg)\n\n## Description\n\nColor-Craftsman creates perceptually-distinct color palettes for data visualization in Python. While many great plotting libaries exist, they often rely on fixed color palettes and generally have few colors. These colors often conflict with one another. Color-Craftsman allows users to create a palette of colors that are perceptually distinct from one another. This allows for more colors to be used in a plot without sacrificing readability.\n\n## Installation\n\n```bash\npip install color-craftsman\n```\n\n## Usage\n\nSimple examples are shown below. For more examples, see the [examples](./examples) directory.\n\n### Creating a Random Palette\n\n```python\nimport color_craftsman as cc\n\n# Create a palette with 5 colors\npalette = cc.generate_palette(\n 5,\n min_dist=30,\n seed=11,\n output_format=\"rgb\",\n)\ncc.visualize_palette(palette, show=True)\n```\n\n![base_palette](./images/base_palette.png)\n\n`Note:` a random seed can be provided to ensure reproducibility. Distance is the distance between colors in the palette. A larger distance will result in more distinct colors. If the distance is too large, a warning message will be displayed. Too large of distances can result in colors that are too similar to each other due to clipping in the RGB color space. Distance is defined as the Delta-E color difference between colors in the palette.\n\n### Creating a Palette from a Base Palette\n\n```python\nimport color_craftsman as cc\n\n# Create a palette with 10 total colors\nextended_palette = cc.extend_palette(\n [\n np.array([153, 191, 80]),\n np.array([107, 88, 11]),\n np.array([42, 19, 119]),\n np.array([93, 110, 244]),\n np.array([213, 114, 236]),\n ],\n 10,\n min_dist=10,\n seed=18,\n palette_format=\"rgb\",\n output_format=\"rgb\",\n)\ncc.visualize_palette(extended_palette, show=True)\n```\n\n![extended_palette](./images/extended_palette.png)\n\n### Visualizing a Palette\n\n```python\nimport color_craftsman as cc\n\ncc.visualize_palette(palette, show=True)\n```\n\n### Colorblind-Safe Palettes\n\nTo guard against deutranopia, protanopia, and tritanopia, use the `colorblind_safe` parameter.\n\n```python\npalette = cc.generate_palette(\n 5,\n min_dist=30,\n seed=22,\n output_format=\"rgb\",\n colorblind_safe=True,\n)\ncc.visualize_palette(extended_palette, show=True)\n```\n\n![colorblind_palette](./images/colorblind_safe_palette.png)\n\n#### Specific Colorblindness-Safe Palettes\n\nIf you want to guard against specific-forms of colorblindness, you can specify the type of colorblindness using the following arguments: `deuteranomaly_safe`, `protanomaly_safe`, and `tritanomaly_safe`.\n\n##### Deuteranopia-Safe Palette\n\n```python\npalette = cc.generate_palette(\n 5,\n min_dist=30,\n seed=33,\n output_format=\"rgb\",\n deuteranomaly_safe=True,\n)\ncc.visualize_palette(palette, show=True)\n```\n\n![deuteranomaly_palette](./images/deuteranopia_safe_palette.png)\n\n##### Protanopia-Safe Palette\n\n```python\npalette = cc.generate_palette(\n 5,\n min_dist=30,\n seed=44,\n output_format=\"rgb\",\n protanomaly_safe=True,\n)\ncc.visualize_palette(palette, show=True)\n```\n\n![protanopia_palette](./images/protanopia_safe_palette.png)\n\n##### Tritanopia-Safe Palette\n\n```python\npalette = cc.generate_palette(\n 5,\n min_dist=30,\n seed=55,\n output_format=\"rgb\",\n tritanomaly_safe=True,\n)\ncc.visualize_palette(palette, show=True)\n```\n\n![tritanopia_palette](./images/tritanopia_safe_palette.png)\n\n## Contributing\n\nContributions are welcome! If you'd like to contribute to the project, please follow these guidelines:\n\n1. Fork the repository.\n2. Create a new branch.\n3. Make your changes.\n4. Test your changes thoroughly.\n5. Submit a pull request.\n6. Add caharper as a reviewer.\n\nPlease ensure your code adheres to the project's coding style and conventions.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contact\n\nIf you have any questions, suggestions, or feedback, feel free to reach out:\n\n- Email: [caharper@smu.edu](mailto:caharper@smu.edu)\n- GitHub: [caharper](https://github.com/caharper)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Perceptually-distinct color palette generator for data visualization in Python.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/caharper/color-craftsman",
"Repository": "https://github.com/caharper/color-craftsman"
},
"split_keywords": [
"data visualization",
"color palette",
"perceptual distinctiveness",
"color-blind safe",
"visualization tools",
"python",
"color theory",
"accessible visualizations"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "36cf6eb1503f934ad22fb8a1d653e294c53237c1098568062b9e5eeb2193ac8a",
"md5": "6cdf1bf133d308c62712e1484464639f",
"sha256": "74e361b0395392c203f147c43eea7071e9f4e2a6926458aa3cbe6214047fcc2b"
},
"downloads": -1,
"filename": "color_craftsman-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6cdf1bf133d308c62712e1484464639f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7920,
"upload_time": "2024-02-06T22:30:25",
"upload_time_iso_8601": "2024-02-06T22:30:25.433305Z",
"url": "https://files.pythonhosted.org/packages/36/cf/6eb1503f934ad22fb8a1d653e294c53237c1098568062b9e5eeb2193ac8a/color_craftsman-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "38eccab0bbb0171e852fd3e07a62dee3dd98b9c5f20b8d1f88e7bb467e8e6814",
"md5": "5779100d251b812dff5561dd5fbf6c34",
"sha256": "95074e423e692750f3c3768ebbd4e99f679bef2cf1512ee09e6d25903bbf17c1"
},
"downloads": -1,
"filename": "color_craftsman-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5779100d251b812dff5561dd5fbf6c34",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6154,
"upload_time": "2024-02-06T22:30:27",
"upload_time_iso_8601": "2024-02-06T22:30:27.403307Z",
"url": "https://files.pythonhosted.org/packages/38/ec/cab0bbb0171e852fd3e07a62dee3dd98b9c5f20b8d1f88e7bb467e8e6814/color_craftsman-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-06 22:30:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "caharper",
"github_project": "color-craftsman",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "color-craftsman"
}