Skip to main content

colour name choosing app, for rich and CSS4 palettes

Project description

khcolors 🎨

Searching for colour names in terminal

Python version Packaged with hatch

khcolors is a terminal application for searching colour names.

Table of Contents

Introduction

The application helps choosing a colour name from rich or CSS4 palettes. khcolors when given name, presents a list of all the colours containing the name; user can choose an index of a particular colour.

Sources for the colour names are matplotlib.colors and rich.color.ANSI_COLOR_NAMES. Thus the user can easily choose the appropriate colour shade, either working with matplotlib, or rich.

Searching for the colour name involves basic python data structures, lists and dictionaries, since datasets of all the colour names were considered small.

Since the application was designed as auxiliary tool, the command line interface was chosen, with minimalistic, though appealing, text formatting. Styling of the text was achieved mostly with the rich module; in one case ANSI codes were used.

A possibility of using/defining custom colour palettes is to be implemented in the future release.

  • Installation

  • Building locally

Clone (git clone https://github.com/pykhaz/khcolors.git) or download the package (github.com/pykhaz/khcolors → button/menu "Code" → "Download ZIP"), cd into khcolors and

hatch build
pip install .
  • Installing from PyPI
pip install khcolors

Usage

The easiest way to use the application is to type khcolors followed by the name of base colour, eg.

khcolors olive

All the colours containing the name given as the parameter, the base colour, are printed in the terminal, and user is asked to choose one. After confirming the choice, the colour name, or rgb triplet, are copied to clipboard and a confirmation message is displayed.

If the name of a palette is given as a parameter (currently two palettes are available: base and base-bright), the colours in the palette are displayed in the terminal and the user is asked to choose one.

Application options:

  • -c / --css -- for using matplotlib CSS4 palettes instead of rich (which is default),

  • -r / --rgb -- for copying (r, g, b) tuple, instead of the name.

Screenshots:

`khcolors` for `salmon`
khcolors for colour 'salmon', cases for all the options (linux).

`khcolors` for `salmon`
khcolors for colour 'salmon', cases for all the options (windows).

Known issues

  • Minimal terminal width -- as the width of the terminal grows smaller, the colour lines get messy. When the width drops below below 37 columns, a single colour line gets printed in two rows, which looks bad (but this is hardly a case, since the terminal window width is, in most cases, greater than 37 columns).

Release History

  • 0.3.3
    • updated README.md
  • 0.3.2
    • new command line argument: -r/--rgb -- for copying (r, g, b) tuple, instead of the name; -a/-all removed
    • options for showing colors palette added: when khcolors called with the name of a palette (base, base-bright), the palette is shown
    • new file, lib.py; functions moved: _get_rgb, _luminosity, byte_rgb, get_contrast_color; vars: LMN_CMPS, LMN_LT, COLOR_PALETTE
    • get_contrast_color: new function for getting foreground/background colors right
    • 3 new functions carved out from get_color_name: get_palette, get_color_choices, find_colors
    • color tiles -- rows of colors printed -- remade completely
  • 0.1.1
    • Minor change of the result message
  • 0.1.0
    • First working version of the package
  • 0.0.1
    • Work in progress

License

The khcolors application is distributed under the MIT license. See LICENSE for more information.

Contact

khaz – pykhaz@o2.pl

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

khcolors-0.3.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

khcolors-0.3.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file khcolors-0.3.3.tar.gz.

File metadata

  • Download URL: khcolors-0.3.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for khcolors-0.3.3.tar.gz
Algorithm Hash digest
SHA256 4ba398152b756de2c66ecd344bee5d8d64b6d6fedee7c524abffc1e2e75f1078
MD5 fbfe9ee54f6769df8cda2ce37701142c
BLAKE2b-256 fbece5766dfc942ca1cd73df33ecd33029916e0b00ab63e34a60f21f5c7b5e4f

See more details on using hashes here.

File details

Details for the file khcolors-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: khcolors-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for khcolors-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f58ec771f1e9599f25bf149433acbd58030e86f0e21c0c9b1ac3b42c1e4b1507
MD5 e603890ccef6833a9135790a924b9c4a
BLAKE2b-256 cf69a54196b5d525cdd57debf4adbcdfe61b7481b8a260df3b9ef2c913262fb0

See more details on using hashes here.

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