Skip to main content

Color shades generator

Project description

Kleur: HSLuv based color utils & palette generators

Poetry PyPI - Version PyPI - Python Versions

I'd like to give special credits to Alexei Boronine and everyone else who contributed to the HSLuv project. This work provided the fundaments to build this package on (and is the only dependency used in it).

alt text alt text

Library usage

When used as a dependency the kleur package contains convenience wrappers around the HSLuv Python API, as well as utilities for styling console ouput built on top of it.

(API reference to be added)

Installation

pip install kleur

Command line usage

Installation

pip install kleur[cli]

Preview a color palette

General help

$ kleur palette -h
usage: kleur palette [-h] [-c NAME=HUE (1-360) [NAME=HUE (1-360) ...]]
[-m] [-a] [-s NUMBER_OF_SHADES] [-v NUMBER_OF_VIBRANCES]

options:
  -h, --help            show this help message and exit
  -c, --colors NAME=HUE (1-360) [NAME=HUE (1-360) ...]
  -m, --merge-with-default-palette
  -a, --alt-default-palette
  -s, --number-of-shades NUMBER_OF_SHADES
  -v, --number-of-vibrances NUMBER_OF_VIBRANCES

Preview default palette

$ kleur palette

alt text

Preview custom palette

$ kleur palette -c green=143 blue=257 tomato=21 violet=273

alt text

Preview custom palette merged with default palette

$ kleur palette -c green=143 blue=257 tomato=21 violet=273 -m

alt text

Generate shades (as CSS variables), based one 1 or 2 (hex) colors

General help

$ kleur shades -h
usage: kleur shades [-h] [-l LABEL] -c COLOR1 [-k COLOR2]
[-s NUMBER_OF_SHADES] [-b] [-i] [-d DYNAMIC_RANGE]

options:
  -h, --help            show this help message and exit
  -l, --label LABEL
  -c, --color1 COLOR1
  -k, --color2 COLOR2
  -s, --number-of-shades NUMBER_OF_SHADES
  -b, --include-black-and-white
  -i, --include-input-shades
  -d, --dynamic-range DYNAMIC_RANGE

Based on one input color

$ kleur shades -l tables -c 7ab1e5

alt text

With input markers:

$ kleur shades -l tables -c 7ab1e5 -i

alt text

Based on two input colors

The dynamic range specifies to what degree the hue of the input colors will be used as boundaries:

  • Dynamic range 0 (0%):

    The shades will interpolate (or extrapolate) between the input colors.

  • Dynamic range between 0 and 1 (between 0% and 100%):

    The shades will interpolate (or extrapolate) between darker / brighter shades of the input colors.

  • Dynamic range 1 (100%):

    The shades will interpolate between the darkest & brightest shades of the input colors.

$ kleur shades -l bad-guy -c badddd -k aa601f -d 66

alt text

With input markers, varying in dynamic range:

$ kleur shades -l bad-guy -c badddd -k aa601f -d 0 -i

alt text

$ kleur shades -l bad-guy -c badddd -k aa601f -d 50 -i

alt text

$ kleur shades -l bad-guy -c badddd -k aa601f -d 100 -i

alt text

Project details


Download files

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

Source Distribution

kleur-2.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kleur-2.0.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file kleur-2.0.0.tar.gz.

File metadata

  • Download URL: kleur-2.0.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kleur-2.0.0.tar.gz
Algorithm Hash digest
SHA256 4a5c69cfdccc0de5ccebc150076c31bbe704ff841607f6bc08a3fc9fcfbf025b
MD5 1679b9b4869d263184f8af6b005f940f
BLAKE2b-256 84bb775a6b5a59d1ad49664c29f7c3f9e0218edfbe2209fb930c5eaf28413280

See more details on using hashes here.

Provenance

The following attestation bundles were made for kleur-2.0.0.tar.gz:

Publisher: on-release-tag__publish-to-pypi.yml on githuib/kleur

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kleur-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: kleur-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kleur-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e449223bb7e34478b4a32c57b76bd2d80530a1cb51828f6d464e5c65162b5ee
MD5 50e9b98810d2b9926221aa7716a26fc2
BLAKE2b-256 2a47a0b08e61ce88af2a3118091491c23baa9af46ab931fa01e752a1a2706176

See more details on using hashes here.

Provenance

The following attestation bundles were made for kleur-2.0.0-py3-none-any.whl:

Publisher: on-release-tag__publish-to-pypi.yml on githuib/kleur

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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