Command-line tool for looking up colors and palettes.

Overview

Colorpedia

Colorpedia is a command-line tool for looking up colors, shades and palettes.

Supported color models: HEX, RGB, HSL, HSV, CMYK.

Demo GIF Build CodeQL Codecov PyPI version GitHub license Python version

Requirements

  • Modern terminal with true color and utf-8 support (e.g. Windows Terminal, PowerShell, iTerm2, Terminator)
  • Python 3.6+

Installation

Install via pip:

pip install colorpedia

For conda users:

conda install colorpedia -c conda-forge

You can then use the color command:

color --help

If you have a name collision on Windows, use colorpedia instead:

colorpedia --help

Usage

Look up colors using various color models:

color name green            # CSS3 color name
color hex FFFFFF            # hex code without the hash (#) prefix
color rgb 255 255 255       # RGB (Red Green Blue)
color hsl 360 100 100       # HSL (Hue Saturation Lightness)
color hsv 360 100 100       # HSV (Hue Saturation Brightness)
color cmyk 100 100 100 100  # CMYK (Cyan Magenta Yellow Black)

Use --shades to display shades of a color:

color name green --shades    # Display 15 colors by default
color hex FFFFFF --shades=5  # Display 5 shades

Look up color palettes:

color palette molokai
color palette facebook
color palette zenburn

Control the output with global flags:

color name yellow --all      # Display all details
color name yellow --json     # Display in JSON format
color name yellow --units    # Display unit symbols
color name yellow --nojson   # Do not display in JSON
color name yellow --nounits  # Do not display unit symbols

Combine with other command-line tools like jq:

color palette molokai | cut -d'|' -f 2,3,4
color name blue --range --json | jq .[0].name

Use --help to display more information on each subcommand:

color name --help
color rgb --help
color palette --help

Tab Completion

For Bash, add the following line in ~/.bashrc or ~/.bash_profile:

source <(color -- --completion)

For Zsh, add the following lines in ~/.zshrc:

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit

source <(color -- --completion | sed "s/:/: /g")

Replace color with colorpedia if you are using the latter.

Configuration

Initialize the configuration file to customize CLI behavior:

color config init

The command above creates ~/.config/colorpedia/config.json with default settings:

{
  // Always display in JSON format. Use with --nojson global flag.
  "always_output_json": false,
  
  // Suffix for approximate color names (e.g. "green~").
  "approx_name_suffix": "~",
  
  // Default number of shades displayed when --shades is used without a count.
  "default_shades_count": 15,
  
  // Display degrees angle (°) symbol. Use with --nounits global flag.
  "display_degree_symbol": false,
  
  // Display percentage (%) symbol. Use with --nounits global flag.
  "display_percent_symbol": false,
  
  // Height of the color box displayed in single-color (get) view.
  "get_view_color_height": 10,
  
  // Width of the color box displayed in single-color (get) view.
  "get_view_color_width": 20,
  
  // Keys displayed in single-color (get) view.
  "get_view_keys": ["name", "hex", "rgb", "color", "hsl", "hsv", "cmyk"],
  
  // Keys displayed in JSON view.
  "json_keys": ["name", "is_name_exact", "hex", "rgb", "hsl", "hsv", "cmyk"],
  
  // Width of the color box displayed in multi-color (list) view.
  "list_view_color_width": 20,
  
  // Keys displayed in multi-color (list) view.
  "list_view_keys": ["name", "hex", "rgb", "color", "hsl", "hsv", "cmyk"],
  
  // Always uppercase hex codes if set to true, lowercase if set to false.
  "uppercase_hex_codes": true
}

Display or edit the configuration file:

color config show  # Display configuration
color config edit  # Edit configuration via a text editor

Technical Notes

  • Names of "unknown" colors are approximated using minimum RGB delta:
    delta = (R1 - R2) ^ 2 + (G1 - G2) ^ 2 + (B1 - B2) ^ 2
    
    If there is are ties, all names are included in the output.
  • Percentage values use 0 - 100 scale by default, 0 - 1 scale in JSON.
  • Degree angles use 0 - 360 scale by default, 0 - 1 scale in JSON.
  • Percent and degree unit symbols are omitted in JSON.
  • If HSV/HSL/CMYK values do not map exactly to an RGB triplet, they are rounded to the nearest one.
You might also like...
A lightweight Python module and command-line tool for generating NATO APP-6(D) compliant military symbols from both ID codes and natural language names

Python military symbols This is a lightweight Python module, including a command-line script, to generate NATO APP-6(D) compliant military symbol icon

Python command line tool and python engine to label table fields and fields in data files.

Python command line tool and python engine to label table fields and fields in data files. It could help to find meaningful data in your tables and data files or to find Personal identifable information (PII).

A command line tool to hide and reveal information inside images (works for both PNGs and JPGs)
A command line tool to hide and reveal information inside images (works for both PNGs and JPGs)

Imgrerite A command line tool to hide and reveal information inside images (works for both PNGs and JPGs) Dependencies Python 3 Git Most of the Linux

gget is a free and open-source command-line tool and Python package that enables efficient querying of genomic databases.
gget is a free and open-source command-line tool and Python package that enables efficient querying of genomic databases.

gget is a free and open-source command-line tool and Python package that enables efficient querying of genomic databases. gget consists of a collection of separate but interoperable modules, each designed to facilitate one type of database querying in a single line of code.

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Free and Open-Source Command Line tool for Text Replacement
Free and Open-Source Command Line tool for Text Replacement

Sniplet Free and Open Source Text Replacement Tool Description: Sniplet is a work in progress CLI tool which can do text replacement globally in Linux

A command line tool to remove background from video and image
A command line tool to remove background from video and image

A command line tool to remove background from video and image, brought to you by BackgroundRemover.app which is an app made by nadermx powered by this tool

A command line tool (and Python library) for archiving Twitter JSON

A command line tool (and Python library) for archiving Twitter JSON

Command line tool to keep track of your favorite playlists on YouTube and many other places.

Command line tool to keep track of your favorite playlists on YouTube and many other places.

Comments
  • Bad hex code when using 212121

    Bad hex code when using 212121

    Cool tool! Thank you so much for sharing it!

    Entity | Version --- | --- colorpedia | 1.1.0 Python | 3.9.1

    When I run

    % color hex 212121
    Bad hex code (expecting a string matching ^(?:[0-9a-fA-F]{3}){1,2}$)
    

    #212121 seems to be a valid hex code.

    opened by paw-lu 9
  • [Feature Suggestion] Commands to manipulate user-defined palettes

    [Feature Suggestion] Commands to manipulate user-defined palettes

    To add a new palette,

    colorpedia palette create <name> <path_to_json_file>

    If there is already one, ask the user if want to overwrite or not.

    To delete a palette,

    colorpedia palette remove <name>

    enhancement 
    opened by dinhanhx 3
  • Colorpedia

    Colorpedia

    just installed colorpedia using pip... I cant seem to run this .. I am getting the following error message

    Traceback (most recent call last): File "/Users/user/anaconda3/bin/color", line 5, in from colorpedia.cli import entry_point File "/Users/user/anaconda3/lib/python3.6/site-packages/colorpedia/init.py", line 1, in from colorpedia.color import Color File "/Users/user/anaconda3/lib/python3.6/site-packages/colorpedia/color.py", line 1, in from dataclasses import dataclass ModuleNotFoundError: No module named 'dataclasses'

    Please help

    opened by coderchai 2
Releases(1.2.3)
A CLI Password Manager made using Python and Postgresql database.

ManageMyPasswords (CLI Edition) A CLI Password Manager made using Python and Postgresql database. Quick Start Guide First Clone The Project git clone

Imira Randeniya 1 Sep 11, 2022
Play Wordle Bot - Wordle Bot written in python

Wordle Bot A Bot written in python with a CL Interface to guess adn solve Wordle

Prashant 1 Feb 25, 2022
organize your books on the command line

organize your books on the command line

Ben Winston 19 Jan 21, 2022
Albert launcher extension for converting units of length, mass, speed, temperature, time, current, luminosity, printing measurements, molecular substance, and more

unit-converter-albert-ext Extension for converting units of length, mass, speed, temperature, time, current, luminosity, printing measurements, molecu

Jonah Lawrence 2 Jan 13, 2022
Hurry is a CLI tool to speed setting up MoniGoMani HyperStrategy & co. #freqtrade #hyperopting #trading #strategy

Hurry is a CLI tool to speed setting up MoniGoMani HyperStrategy & co. #freqtrade #hyperopting #trading #strategy

10 Dec 29, 2022
Browse Hacker News like a haxor: A Hacker News command line interface (CLI).

haxor-news Coworker who sees me looking at something in a browser: "Glad you're not busy; I need you to do this, this, this..." Coworker who sees me s

Donne Martin 3.8k Jan 07, 2023
Proman is a simple tool for managing projects through cli.

proman proman is a project manager. It helps you manage your projects from a terminal. The features are listed below. Installation Step 1: Download or

Arjun Somvanshi 2 Dec 06, 2021
Custom function scheduler TUI (text-based user interface) in the console

Custom function scheduler TUI (text-based user interface) in the console

Luke 1 Oct 26, 2022
A very simple OpenContest command line client written in Python

OpenContest Client A very simple OpenContest command line client written in Python. The only dependency is the requests library. Tested with Linux onl

Ladue Computer Science 1 May 25, 2022
A stupidly simple task list to keep you productive and focused.

StupidlySimple-TaskList A stupidly simple task list to keep you productive and focused. There is really nothing to it. This is a terminal-based script

Jack Soderstrom 1 Nov 28, 2021
Analysis of a daily word game "Wordle"

Wordle Analysis of a daily word game "Wordle" https://www.powerlanguage.co.uk/wordle/ Description Worlde is a daily word game in which a player attemp

Bartek 1 Feb 07, 2022
A Python package for a basic CLI and GUI user interface

Organizer CLI Organizer CLI is a python command line tool that goes through a given directory and organizes all un-folder bound files into folders by

Caltech Library 12 Mar 25, 2022
This is my fetch, with ascii arts from neofetch and internet

deadfetch This is my fetch, with ascii arts from neofetch and internet Installation First what you need its python Fedora sudo dnf install python3 sud

DedSec 8 Jan 20, 2022
🖥️ A cross-platform modern shell.

Ergonomica WARNING: master on this repository is not the same as a stable release! Currently, this software is purely experimental, as I am cleaning i

813 Dec 27, 2022
AthenaCLI is a CLI tool for AWS Athena service that can do auto-completion and syntax highlighting.

Introduction AthenaCLI is a command line interface (CLI) for the Athena service that can do auto-completion and syntax highlighting, and is a proud me

dbcli 192 Jan 07, 2023
pypinfo is a simple CLI to access PyPI download statistics via Google's BigQuery.

pypinfo: View PyPI download statistics with ease. pypinfo is a simple CLI to access PyPI download statistics via Google's BigQuery. Installation pypin

Ofek Lev 351 Dec 26, 2022
Bad Apple printed out on the console with Python!

Bad Apple printed out on the console with Python!

CalvinLoke 186 Dec 01, 2022
Free and Open-Source Command Line tool for Text Replacement

Sniplet Free and Open Source Text Replacement Tool Description: Sniplet is a work in progress CLI tool which can do text replacement globally in Linux

Veeraraghavan Narasimhan 13 Nov 28, 2022
This is a simple Termo application in command line style

my-termo This is a simple Termo application in command line style. This app run a Linux crontab task every day to get a new word. Type termo in your t

Gustavo Soares 1 Feb 14, 2022
PipeCat - A command line Youtube music player written in python.

A command line Youtube music player written in python. It's an app written for Linux. It also supports offline playlists that are stored in a

34 Nov 27, 2022