represent and manipulate colors in various contexts. It was created with the
:mod:`FGAme` game engine, but it can also be used in other contexts such as
arts and web applications.
Colors can be initialized from the RGB/RGBA components, in which each component
is in the 0-255 range.
>>> w1 = Color(255, 255, 255)
>>> w2 = Color(255, 255, 255, 255)
>>> w1 == w2
True
The constructor also accepts color names, hex strings or hex numbers.
>>> Color('white') == Color('#FFF') == Color(0xffffff) == Color(255, 255, 255)
True
All names in CSS3.0 are accepted (see the complete list `here<http://www.w3.org/TR/css3-color/#svg-color>`).
It is worth noting that although the *G* in RGB stands for green, the color
with a full green value is called *lime*, while "green" is **#008000** rather than
**#00FF00**.
Usage and API
-------------
Color objects are immutable and behave like a tuple of 4 values.
>>> list(Color('green'))
[0, 80, 0, 255]
It also exposes several different representations of a color using the
appropriate attribute.
>>> blue = Color('blue')
>>> blue.rbg
(255, 0, 0)
>>> blue.rgbf
(1.0, 0.0, 0.0)
>>> blue.rgbu
16711680
Color objects also implement a few useful transformations
>>> blue.darken(0.1) # darken by 10%
Color(229, 0, 0)
Metadata
Release files for colortools 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| colortools-0.1.2.tar.gz | 7.7 kB | Without provenance | Details for colortools-0.1.2.tar.gz |
Release files / colortools-0.1.2.tar.gz
| Download URL | colortools-0.1.2.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60db523ad7b6f951c4b810b88e4b2feabbf49691e9d81f5fdb4095423ab03665
|
|
BLAKE2b-256 checksum How to use checksums |
a2d6471b82eb96ec1d92055165f65f33083e4244b29deec715549182f60e518e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for colortools 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.