Skip to main content

Nearest Colours

Find the nearest W3C/X11 named colors to a given color. This module, nearest_colour, provides two functions:

from typing import List, Literal, Union
from colour import Color

ColorSpace = Literal["hsv", "rgb", "yiq", "hls"]

def nearest_x11(color: Union[Color, str], n: int = 1, space: ColorSpace = "hls") -> List[Color]:
    pass


def nearest_w3c(color: Union[Color, str], n: int = 1, space: ColorSpace = "hls") -> List[Color]:
    pass

Each will return the n colors that are closest (Euclidean distance) to color in the specified color-space from either the set of W3C web colors or the set of Unix X11 colors. Web colors are standardized by W3C, whereas Unix X11 colors are defined in the X11 source-code. Note: these two sets of colors are almost entirely overlapping, but not completely. Colors may be provided as either colour Color objects, or as W3C colors strings. The default color-space for distance computation is HSL, which is perceptually uniform and therefore returns colors which are perceptually closer to the given color. A list is always returned, even if n == 1, and the ordering is from most similar to least similar. If you pass a large wnough integer (say, 256), you'll get the ranking for all colors in the respective set.

Metadata

Release files for nearest-colour 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nearest-colour 1.0.0
File Size Uploaded Provenance Actions
nearest-colour-1.0.0.tar.gz 5.5 kB Without provenance Details for nearest-colour-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nearest-colour 1.0.0
File Interpreter ABI Platform Actions
nearest_colour-1.0.0-py3-none-any.whl Python 3 none any Details for nearest_colour-1.0.0-py3-none-any.whl

Total release size: 12.0 kB

Release files / nearest-colour-1.0.0.tar.gz

Download URL nearest-colour-1.0.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
46e7c1078968c4a890f877dd48b5cc8328a8ff9d3acf67360b8e53ba38b2007a
BLAKE2b-256 checksum
How to use checksums
acb9d1a8954c4d96f0bfd8a6a753c2f5a029f2461f4d7b90bb2c94d1f3ac3159
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.7 Linux/5.11.0-44-generic

Release files / nearest_colour-1.0.0-py3-none-any.whl

Download URL nearest_colour-1.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1decafd407dd3f396a3560f1ca5bbc929dd4e900588b51e6124ed915168b3b0e
BLAKE2b-256 checksum
How to use checksums
1ad7ebd68cee3f4bd841bb610adc7b3acc04c3f7f4cd85bd09e0162d9e7128cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.7 Linux/5.11.0-44-generic

Security for nearest-colour 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page