Skip to main content

A color library for CSS colors.

Project description

Donate via PayPal Discord Build Coverage Status PyPI Version PyPI - Python Version License

ColorAide

This is still a work in progress.

Overview

ColorAide is a color library for Python with the intent to provide an easy to use interface to work with colors. While ColorAide is not just for CSS colors, there is a focus on supporting modern CSS color syntax as it is a format that is very commonly used. In addition to being able to parse almost all colors as specified in the CSS specification, ColorAide also supports a number of colors and formats for colors that are not in the CSS spec.

ColorAide is built on the idea of having a general color object in which you can easily manipulate a color, convert between colors in different spaces, and perform color related functions: interpolation, color distancing, color contrast, etc.

In the process of developing ColorAide, we also stumbled upon the JavaScript library Color.js which is created/maintained by the co-authors of some of the recent CSS color specifications. This project became heavily influenced by Color.js as it adopted a model we were already interested in. While our aim was not to port that library and be a 1:1 copy of it, it provided much clarity on the CSS specification and, in the end, left a clear impression on our API.

With ColorAide, you can specify a color, convert it to other color spaces, mix it with other colors, output it in different CSS formats, and much more!

>>> from coloraide import Color
>>> c = Color("red")
>>> c.to_string()
'rgb(255 0 0)'
>>> c.convert('hsl').to_string()
'hsl(0 100% 50%)'
>>> c.set("lch.chroma", 30).to_string()
'rgb(173.81 114.29 97.218)'
>>> Color("blue").mix("yellow", space="lch").to_string()
'rgb(255 65.751 107.47)'

Documentation

https://facelessuser.github.io/coloraide

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coloraide-0.1.0a23.tar.gz (656.8 kB view details)

Uploaded Source

Built Distribution

coloraide-0.1.0a23-py3-none-any.whl (67.8 kB view details)

Uploaded Python 3

File details

Details for the file coloraide-0.1.0a23.tar.gz.

File metadata

  • Download URL: coloraide-0.1.0a23.tar.gz
  • Upload date:
  • Size: 656.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

File hashes

Hashes for coloraide-0.1.0a23.tar.gz
Algorithm Hash digest
SHA256 4d8eea4b27d1bdc758403bea925b640a9dd6405ff348127991cc320dcb39ea5f
MD5 ddfe5aa6476c654422541799e49c663e
BLAKE2b-256 e4bc3955c2cb0b9f2ef65b1a38a06a2e0294fc8a0264fea671968483e0e1e998

See more details on using hashes here.

File details

Details for the file coloraide-0.1.0a23-py3-none-any.whl.

File metadata

  • Download URL: coloraide-0.1.0a23-py3-none-any.whl
  • Upload date:
  • Size: 67.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

File hashes

Hashes for coloraide-0.1.0a23-py3-none-any.whl
Algorithm Hash digest
SHA256 a857015680f10c3bfe09518a993d06b87008e7e18b1383afea5cf183ff39cdfd
MD5 d8e6a1916f8ce0ea12d6be43b98bffdb
BLAKE2b-256 89e532d7892b56054b85c998e90ad3ede87b9922b787dd2c121fc6ead4580cba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page