Verna
A simple module to handle colors
Only RGBA colors are supported at the moment.
Installation
You need Python>=3.6 to use Verna.
It can be installed from PyPI with pip using
pip install verna
Usage
Colors are represented using objects of class Color.
The color value is essentially stored as an integer as the integer attribute.
The following properties can be used to access the different color components.
color.alpha
color.red
color.green
color.blue
where color is an instance of Color.
The different color components can be edited with one of the following values
- a percentage in string form with a '%' at the end (eg: "20%")
- an integer from 0 to 255 (eg: 0xff, 255)
- a float from 0.0 to 1.0 (only for
alphaproperty. eg: 0.4)
So, the following are valid:
color = Color(0x00ffff)
color.alpha = 0x80
color.alpha = "50%"
color.alpha = 0.5 # float values can be assigned
# only to alpha property
color.red = 0xff # Same as color.red = 255
color.red = "100%"
color.green = 217
color.green = "85%"
color.blue = 0xf5
color.blue = "96%"
whereas the following will cause error:
color = Color(0x00ffff)
color.alpha = 0x1ff # > 0xff
color.alpha = -1 # < 0.0
color.alpha = "120%" # > 100%
color.alpha = "120" # No '%' at end
color.alpha = 1.2 # > 1.0
color.alpha = True # Invalid type: bool
color.red = 0.5 # float value accepted only for alpha
A Color object may be created in multiple ways.
By default, alpha value is 0.
From integer color code
For example, cyan (solid), which has color code 0x00ffff can be created like
Color(0x00ffff)
which is same as
Color(65535)
From color name
Color.from_name() can be used to create Color objects from a CSS3 color name.
For example, cyan can be created with
Color.from_name('cyan')
From RGBA values
Color.from_rgba() can be used to create an instance of Color from RGBA values.
Color.from_rgba(255, 255, 0) # solid yellow
Color.from_rgba(255, 255, 0, 0.5) # translucent yellow
Metadata
Release files for verna 0.0.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 |
|---|---|---|---|---|
| verna-0.0.2.tar.gz | 6.6 kB | Without provenance | Details for verna-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| verna-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for verna-0.0.2-py3-none-any.whl |
Total release size: 12.9 kB
Release files / verna-0.0.2.tar.gz
| Download URL | verna-0.0.2.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81e420c82dce2316a70d7547f2e8f935fb60332a1836f2462ff67fcfef537651
|
|
BLAKE2b-256 checksum How to use checksums |
3bd5ada42226920dd0f0ef758b18a52c81e496a49477748d73f24b3a987d61da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.9
|
Release files / verna-0.0.2-py3-none-any.whl
| Download URL | verna-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d6b13c70aac865529587f7625ad10dd96fda92a67b9dea7b49ca0a8b8efcc0b
|
|
BLAKE2b-256 checksum How to use checksums |
18d78c3634b7c477576c3d07881dac9649f4a51fe33798ca56684d4be3fc011d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.9
|
Security for verna 0.0.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.