https://github.com/getcuia/ochre
🏜️ A down-to-earth approach to colors
https://github.com/getcuia/ochre
ansi color color-conversion color-manipulation color-palettes colors cuia hcl hex manipulate-colors ochre python python-library rgb web zero-dependency
Last synced: 10 months ago
JSON representation
🏜️ A down-to-earth approach to colors
- Host: GitHub
- URL: https://github.com/getcuia/ochre
- Owner: getcuia
- License: mit
- Created: 2021-11-13T18:42:23.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T17:01:51.000Z (almost 3 years ago)
- Last Synced: 2025-04-09T18:16:09.193Z (10 months ago)
- Topics: ansi, color, color-conversion, color-manipulation, color-palettes, colors, cuia, hcl, hex, manipulate-colors, ochre, python, python-library, rgb, web, zero-dependency
- Language: Python
- Homepage: https://pypi.org/project/ochre/
- Size: 626 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pypi.org/project/ochre/)
[](https://github.com/getcuia/ochre/actions/workflows/python-package.yml)
[](https://github.com/getcuia/ochre/blob/main/LICENSE)
# [ochre](https://github.com/getcuia/ochre#readme) 🏜️
> A down-to-earth approach to colors
ochre is a tiny Python package for working with colors in a pragmatic way. The
focus is on simplicity and ease of use, but also on human perception.
## Features
- 🎨 Focus on [RGB](https://en.wikipedia.org/wiki/RGB_color_model) and
[HCL](https://en.wikipedia.org/wiki/HCL_color_space) color spaces
- 🖥️ [Web color names](https://en.wikipedia.org/wiki/Web_colors#Extended_colors)
- ♻️ Color conversions that easily integrate with the
[standard `colorsys` module](https://docs.python.org/3/library/colorsys.html)
- 🗑️ Zero dependencies
- 🐍 Python 3.8+
## Installation
```console
$ pip install ochre
```
## Usage
```python
In [1]: from ochre import Hex
In [2]: color = Hex("#CC7722")
In [3]: color.web_color
Out[3]: WebColor('peru')
In [4]: color = color.hcl
In [5]: color.hue
Out[5]: 0.6373041934059377
In [6]: import math
In [7]: color.hue += math.radians(30)
In [8]: color.hue
Out[8]: 1.1609029690042365
In [9]: color.web_color
Out[9]: WebColor('goldenrod')
```
## Credits
[Photo](https://github.com/getcuia/ochre/raw/main/banner.jpg) by
[Nicola Carter](https://unsplash.com/@ncarterwilts?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
on
[Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).