colour name choosing app, for rich and CSS4 palettes
Project description
khcolors 🎨
Searching for colour names in terminal
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. Presents a list of all the colours containing name given as a parameter.
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 involved 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.
!TODO: about downloading the package/cloning the repo; cding to the directory`
-
Building locally
hatch build pip install .
-
Installing from PyPI
pip install khcolors
To be implemented.
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.
khcolors usage example -- simple:
khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ khcolors oliveChoose colour (number): ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ dark_olive_green3 (175, 215, 95) ░ (1) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ dark_olive_green2 (175, 255, 95) ░ (2) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ dark_olive_green1 (215, 255, 135) ░ (3) Color number to copy? (1-3, <Enter> to exit): 2 Color dark_olive_green2 (175, 255, 95) copied to clipboard. khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ ▁
If the name of a palette is given as a parameter (currently two palettes are available: base and base-dark), the colours in the palette are displayed in the terminal and the user is asked to choose one.
Application options:
-
-c/--css-- for usingmatplotlib CSS4palettes instead ofrich(which is default), -
-r/--rgb-- for copying(r, g, b)tuple, instead of the name.
khcolors usage example -- option -c:
khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ khcolors olive -c Choose colour (number): ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ darkolivegreen (85, 107, 47) ░ (1) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ olive (128, 128, 0) ░ (2) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ olivedrab (107, 142, 35) ░ (3) Color number to copy? (1-3, <Enter> to exit): 2 1 Color darkolivegreen (85, 107, 47) copied to clipboard. khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ ▁
khcolors usage example -- option -cr:
khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ khcolors blue -crChoose colour (number): ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ aliceblue (240, 248, 255) ░ (1) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ blue (0, 0, 255) ░ (2) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ blueviolet (138, 43, 226) ░ (3) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ cadetblue (95, 158, 160) ░ (4) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ cornflowerblue (100, 149, 237) ░ (5) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ darkblue (0, 0, 139) ░ (6) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ darkslateblue (72, 61, 139) ░ (7) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ deepskyblue (0, 191, 255) ░ (8) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ dodgerblue (30, 144, 255) ░ (9) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ lightblue (173, 216, 230) ░ (10) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ lightskyblue (135, 206, 250) ░ (11) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ lightsteelblue (176, 196, 222) ░ (12) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ mediumblue (0, 0, 205) ░ (13) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ mediumslateblue (123, 104, 238) ░ (14) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ midnightblue (25, 25, 112) ░ (15) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ powderblue (176, 224, 230) ░ (16) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ royalblue (65, 105, 225) ░ (17) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ skyblue (135, 206, 235) ░ (18) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ slateblue (106, 90, 205) ░ (19) ░ ⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺ steelblue (70, 130, 180) ░ (20) Color number to copy? (1-20, <Enter> to exit): 7 Color (72, 61, 139) (darkslateblue) copied to clipboard. khaz@mainframe:~/spy/dev/cli/utils/khcolors/assets$ ▁
Release History
- 0.3.2
- new command line argument:
-r/--rgb-- for copying(r, g, b)tuple, instead of the name;-a/-allremoved - options for showing colors palette added: when
khcolorscalled 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
- new command line argument:
- 0.1.1
- Minor change of the result message
- 0.1.0
- First working version of the package
- 0.0.1
- Work in progress
Contact
khaz – pykhaz@o2.pl
License
The khcolors application is distributed under the MIT license. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file khcolors-0.3.2.tar.gz.
File metadata
- Download URL: khcolors-0.3.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74be7aac994c62625250e99663702264fb51b300dc6721acb3824438cd4a5c1e
|
|
| MD5 |
95694fa480e02f0e9ce6b4a269134def
|
|
| BLAKE2b-256 |
ef858973e732645897bb5ff26e93d9373bb49b4cc73b93d203d1a8b658deb65e
|
File details
Details for the file khcolors-0.3.2-py3-none-any.whl.
File metadata
- Download URL: khcolors-0.3.2-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0fb6c68c49cf16feb2cfb587e78b411aaf9653869c0428dbca9fb9f287f207c
|
|
| MD5 |
5760127240864811a47a3b70e2090264
|
|
| BLAKE2b-256 |
ae7ff94bec16f7c1583327a71a0d4b341652279b2495e133e3539c2574114172
|