Interactive terminal color picker
Project description
termcolours
Simple terminal colour chooser and ANSI code generator utility for Linux, written in Python.
Overview
termcolours is a small TUI (terminal user interface) utility
for working with true-colour (24-bit) ANSI escape sequences in the terminal.
It provides a simple way to generate foreground or background ANSI codes
from RGB colour values.
Features
- Convert colours, passed as
RR;GG;BBstrings, to ANSI sequences - Support for foreground and background colours
- Batch input (see Usage)
- Named palettes generation (see Usage)
- Input based on semi-colon separated RGB triplets
- Designed as a terminal application.
Dependencies
pyperclip
Installation
pip install termcolours
Or install from source:
pip install -e .
Usage
-
Interactive mode: running
termcolourswithout arguments prompts the user for input (e.g.9;149;9). -
Batch input:
termcolours -f <file>, where<file>is an.ssvfile containing colour codes -- each line should be of the formRR;GG;BB;<fmt>,<fmt>being one ofdecm,hexaorprct. -
Named palette generation -- if
.ssvfiles1 are stored in theassetsfolder,termcolourswill automatically generate a palette from them, displaying a menu to choose from.
Examples
Interactive mode
╭─user at main-frame in ~/some/folder 00-13-48 - 26:93:72
╰─∷ termcolours
termcolours v. 0.9.1 -- interactive mode
Enter a colour code (R;G;B, decimal), command or help > 9;149;9
Commands in interactive mode
fg/bgto copy the current colour to the clipboard (ANSI foreground/background, respectively).decm: sets conversion format from a decimal triplet.hexa: sets conversion format from hexadecimal triplet.prct: sets conversion format from percentage triplet.help: prints help message.palette: generates a named palette, from file in theassetsfolder.quit: exits the application.
Batch input
termcolours -f <file>
In the batch input mode any .ssv file with colours specified in the
correct format2 is read. All the parsed colours, along with #hex and
int triplets and with the corresponding ANSI codes, are printed to stdout
after which the program quits.
Named palette
Typing palette in the interactive mode invokes the method. The user is
presented with a menu of available palettes, corresponding to .ssv files
stored in the assets folder. The palette is then generated and printed to
stdout, after which the program quits.
╭─user at main-frame in ~/some/folder 00-13-48 - 26:93:72
╰─∷ termcolours
termcolours v. 0.9.1 -- interactive mode
Enter a colour code (R;G;B, decimal), command or help > palette
'ansi16' | 'forest_vibes' | 'gruvbox' | 'khaz' | 'material_basic'
'navy_light_blue' | 'nord' | 'simple' | 'solarized' | 'turquoise_depths'
Enter a palette name> khaz
Input format
Input semi-colon separated triplets might be in any of the following forms:
- decimal, e.g.
10;90;255(name:decm) - hexadecimal, e.g.
a;5a;ff(name:hexa) - percentage, e.g.
0.04;0.355;1(name:prct)
Invalid input values or formats will result in an error.
License
MIT
-
File with the first line in the form
# palette: <name>; filename: <filenamename>.ssvthe palette will show in the menu as a<name>option. ↩ -
See Input format ↩
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 termcolours-0.11.3.tar.gz.
File metadata
- Download URL: termcolours-0.11.3.tar.gz
- Upload date:
- Size: 116.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.2 cpython/3.10.19 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04dfb0dffd18ae45e394e41c0771bafdc83f67b5bdbe3da5c5096a66ff13cdae
|
|
| MD5 |
d48f3a0ce5859e9b31129ca80530bc3b
|
|
| BLAKE2b-256 |
6907fd14da336b97208af8797d968ca4c6eca5f1d46213b7d82cc664f648adeb
|
File details
Details for the file termcolours-0.11.3-py3-none-any.whl.
File metadata
- Download URL: termcolours-0.11.3-py3-none-any.whl
- Upload date:
- Size: 122.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.2 cpython/3.10.19 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
600c3c25dd603c5fed1b6a089c654afb5b49ba383f6f9e3aa660c1e7822d4a32
|
|
| MD5 |
139efe8686d1de630fb1ce01692c6732
|
|
| BLAKE2b-256 |
df8df410f12567868caa83a4dacd8ee771b6f6ed5374940c19c74d9da3ec37a1
|