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)
dsub is a command-line tool that makes it easy to submit and run batch scripts in the cloud.

Open-source command-line tool to run batch computing tasks and workflows on backend services such as Google Cloud.

Data Biosphere 233 Jan 01, 2023
commandline version of wordle game and my auto solver.

Wordle Machine (and Wordle Game) (in commandline) My implementation of the Wordle game (inspired by https://www.powerlanguage.co.uk/wordle/) and my in

Kevin Xu 11 Jan 03, 2023
iTerm2 Shell integration for Xonsh shell.

iTerm2 Shell Integration iTerm2 Shell integration for Xonsh shell. Installation To install use pip: xpip install xontrib-iterm2 # or: xpip install -U

Noorhteen Raja NJ 6 Dec 29, 2022
Very nice SMS & Mail Bomber for Termux and Linux.

Very nice SMS & Mail Bomber for Termux and Linux. Coded with love)))

nordbearbot.dev 5 Nov 06, 2022
Get COVID-19 vaccination schedules from booking.moh.gov.ge in the CLI

vaccination.py Get COVID-19 vaccination schedules from booking.moh.gov.ge in the CLI. Installation $ pip install vaccination Usage Make sure the Pytho

Temuri Takalandze 11 Dec 08, 2021
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
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
Python Library and CLI for exporting MySQL databases

expdb Python library and CLI for exporting MySQL databases Installation Pre-requisites MySQL server Python 3.9+ Using git Clone the repository to your

Devansh Singh 1 Nov 29, 2021
googler is a power tool to Google (web, news, videos and site search) from the command-line.

googler is a power tool to Google (web, news, videos and site search) from the command-line.

Terminator X 5.9k Jan 04, 2023
dotfilery, configuration, environment settings, automation, etc.

┌┬┐┌─┐┌─┐┌─┐┬ ┬┌┬┐┬ ┬┬┌─┐ │││├┤ │ ┬├─┤│ │ │ ├─┤││ :: bits & bobs, dots & things. ┴ ┴└─┘└─┘┴ ┴┴─┘┴ ┴ ┴ ┴┴└─┘ @megalithic 🚀 Instal

Seth Messer 89 Dec 25, 2022
Ideas on how to quickly learn to build command-line tools

CLI-Bootcamp Ideas on how to quickly learn to build command-line tools Part 1-Bash Week1: Using Linux Lesson 1: Using Linux Shell Lab Lesson 2: How sh

Noah Gift 10 Apr 18, 2022
asciinema - Terminal session recorder 📹

asciinema - Terminal session recorder 📹

asciinema 11.1k Dec 27, 2022
Powerful yet easy command line calculator.

Powerful yet easy command line calculator.

Cruisen 1 Jul 22, 2022
Simple Terminal Styling for Python

escape Escape is a very simple terminal styling library largely inspired by the excellent javascript chalk library. There are other terminal styling l

Syed Abbas 8 Sep 03, 2019
Command Line Based Todo Script

Todo-CLI Features Full-Fledged Command Line Based Todo List with the following features planned: Interactive Interface OS Notifications Save and Remov

DSC IIEST 5 Nov 17, 2021
f90nml - A Fortran namelist parser, generator, and editor

f90nml - A Fortran namelist parser, generator, and editor A Python module and command line tool for parsing Fortran namelist files Documentation The c

Marshall Ward 110 Dec 14, 2022
A CLI tool for using GLIDE to generate images from text.

Text-Glided-Diffusion Installation First clone this repository: git clone https://github.com/afiaka87/text-glided-diffusion.git cd text-glided-diffusi

Clay Mullis 68 Dec 30, 2022
Quickly open any path on your terminal window in your $EDITOR of choice!

Tmux fpp Plugin wrapper around Facebook PathPicker. Quickly open any path on your terminal window in your $EDITOR of choice! Demo Dependencies fpp - F

257 Dec 28, 2022
Projeto Reverse Shell For Python

Use com sabedoria!!! Modo de uso: Linux (inclui Android e Mac): - apt-get update - apt install python3 (ou "python" apenas) - git clone https://github

1 Jan 03, 2022
Random scripts and other bits for interacting with the SpaceX Starlink user terminal hardware

starlink-grpc-tools This repository has a handful of tools for interacting with the gRPC service implemented on the Starlink user terminal (AKA "the d

270 Dec 29, 2022