Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcicen/tcolors
Commandline color picker and palette builder
https://github.com/bcicen/tcolors
cli color-palette color-picker commandline terminal
Last synced: 15 days ago
JSON representation
Commandline color picker and palette builder
- Host: GitHub
- URL: https://github.com/bcicen/tcolors
- Owner: bcicen
- License: mit
- Created: 2019-03-19T12:20:27.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T08:57:22.000Z (8 months ago)
- Last Synced: 2024-10-14T12:54:51.150Z (29 days ago)
- Topics: cli, color-palette, color-picker, commandline, terminal
- Language: Go
- Homepage:
- Size: 125 KB
- Stars: 52
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
**
Commandline color picker and palette builder
**## Overview
`tcolors` is a commandline application for creating palettes of one or more colors in HSV space. Created palettes and their colors may be output in several different formats for import and use into other programs.Colors are imported from, and changes automatically saved to, a human-readable TOML format file.
## Installing
Go get with:
```bash
go install github.com/bcicen/tcolors@latest
```Or download the [latest release](https://github.com/bcicen/tcolors/releases) for your platform:
#### Linux / OSX
```bash
curl -Lo tcolors https://github.com/bcicen/tcolors/releases/download/v0.3.2/tcolors-0.3.2-$(uname -s)-amd64
chmod +x tcolors
sudo mv tcolors /usr/local/bin/
```
#### AUR`tcolors` is also available for Arch in the [AUR](https://aur.archlinux.org/packages/tcolors)
#### Docker
```bash
docker run --rm -ti --name=tcolors \
quay.io/vektorlab/tcolors:latest
```## Usage
Simply run `tcolors` to view and modify the default palette. Changes are automatically saved and will persist across sessions.
### Keybindings
Key | Description
--- | ---
`↑, k` | navigate up
`↓, j` | navigate down
`←, h` | decrease selected value
`→, l` | increase selected value
` + ←/→/h/l` | more quickly increase/decrease selected value
`a, ` | add a new palette color
`x,` | remove the selected palette color
`q, ` | exit tcolors
`?` | show help menu### Palette files
To create a new palette or use a specific palette, use the `-f` option:
```bash
tcolors -f logo-palette.toml
```Palette colors are stored in a human-readable TOML format and all changes are saved on exit.
### Output
In addition to a stored TOML palette file, `tcolors` provides several output options for parsing and using defined colors
#### All
Default output option providing a formatted table of colors
```bash
# tcolors -p
+----+--------+-------------+-------------+------------------------------------+
| # | HEX | HSV | RGB | TERM |
+----+--------+-------------+-------------+------------------------------------+
| bg | 141414 | 000 000 008 | 020 020 020 | \033[38;2;020;020;020m$@\033[0;00m |
| 0 | FF7733 | 020 080 100 | 255 119 051 | \033[38;2;255;119;051m$@\033[0;00m |
| 1 | FFDD33 | 050 080 100 | 255 221 051 | \033[38;2;255;221;051m$@\033[0;00m |
| 2 | C8FF59 | 080 065 100 | 200 255 089 | \033[38;2;200;255;089m$@\033[0;00m |
| 3 | 55FF33 | 110 080 100 | 085 255 051 | \033[38;2;085;255;051m$@\033[0;00m |
| 4 | 33FF77 | 140 080 100 | 051 255 119 | \033[38;2;051;255;119m$@\033[0;00m |
| 5 | 33FFDD | 170 080 100 | 051 255 221 | \033[38;2;051;255;221m$@\033[0;00m |
| 6 | 33BBFF | 200 080 100 | 051 187 255 | \033[38;2;051;187;255m$@\033[0;00m |
+----+--------+-------------+-------------+------------------------------------+
```#### Hex, RGB, HSV
Each of these output options provide all colors in a single comma-delimited line; e.g:
```bash
# tcolors -p -o hex
141414, FF7733, FFDD33, C8FF59, 55FF33, 33FF77, 33FFDD, 33BBFF
```#### Term
The `term` output option provides a series of named functions for easy importing and terminal use
```bash
# tcolors -p -o term
_colorbg() { echo -ne "\033[38;2;020;020;020m$@\033[0;00m"; }
_color0() { echo -ne "\033[38;2;255;119;051m$@\033[0;00m"; }
_color1() { echo -ne "\033[38;2;255;221;051m$@\033[0;00m"; }
_color2() { echo -ne "\033[38;2;200;255;089m$@\033[0;00m"; }
_color3() { echo -ne "\033[38;2;085;255;051m$@\033[0;00m"; }
_color4() { echo -ne "\033[38;2;051;255;119m$@\033[0;00m"; }
_color5() { echo -ne "\033[38;2;051;255;221m$@\033[0;00m"; }
_color6() { echo -ne "\033[38;2;051;187;255m$@\033[0;00m"; }
```Sourcing:
```bash
source <(tcolors -p -o term)
echo "my $(_color2 what) a $(_color4 bright) $(_color6 day)"
```### Options
Option | Description
--- | ---
-f | specify palette file to load/save changes to
-p | output current palette contents
-o | color format to output (hex, rgb, hsv, term, all) (default "all")
-v | print version info