Skip to content

getcuia/ochre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PyPI Python package PyPI - License

ochre ๐Ÿœ๏ธ

ochre

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 and HCL color spaces
  • ๐Ÿ–ฅ๏ธ Web color names
  • โ™ป๏ธ Color conversions that easily integrate with the standard colorsys module
  • ๐Ÿ—‘๏ธ Zero dependencies
  • ๐Ÿ Python 3.8+

Installation

$ pip install ochre

Usage

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 by Nicola Carter on Unsplash.