Skip to main content

Convert colors from one format to another.

Project description

colorforms

Convert colors from one format to another.

This tool will read a color in rgb or hex format piped from stdin, and convert to the opposite format (rgb -> hex, hex -> rgb).

Example:

$ echo "#FFEE00" | colorforms
rgb(255, 238, 0)

Usage notes:

The following patterns are valid:

hhh           (rgb)
#hhh          (rgb)
hhhh          (rgba)
#hhhh         (rgba)
hhhhhh        (rgb)
#hhhhhh       (rgb)
hhhhhhhh      (rgba)
#hhhhhhhh     (rgba)
rgb(n,n,n)    (rgb)
rgb(n,n,n,n)  (rgba)
rgba(n,n,n,n) (rgba)

Installation

From PyPi:

pip install colorforms

...or...

python -m pip install colorforms

Geany integration

I use this tool inside Geany, to quickly convert colors back and forth with a keyboard shortcut.

  1. From the Geany menu, select "Edit -> Format -> Send selection to -> Set custom commands"
  2. In the popup dialog, choose an empty Command / Label line. In the "Command" field, type "colorforms". Add an appropriate label, such as "Convert color format".

Now this tool will be available from the Edit menu.

  1. Select the string you want to convert.
  2. From the Geany menu, select "Edit -> Format -> Send selection to -> Convert color format"

If you put this tool in one of the first three lines, you automatically get a keyboard shortcut you can use to invoke it. For example, entering colorforms on line 2 will make it possible to select a color value, and simply press "CTRL-2" to convert to the opposite format.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colorforms-1.0.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colorforms-1.0.0-py2.py3-none-any.whl (15.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file colorforms-1.0.0.tar.gz.

File metadata

  • Download URL: colorforms-1.0.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for colorforms-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f3885a754caa06868949bbd2c00f14ea0169f34d3e01f4c8ef689e75685113c2
MD5 0a58685b4b2dc274d810bc20b423905c
BLAKE2b-256 a984baad738140199070ee3d88661d8185c331cfe511db69bcdd1d1455a63609

See more details on using hashes here.

File details

Details for the file colorforms-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: colorforms-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for colorforms-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2f7a8ae08e6da16b540170cec1e7d27df464b552008da4112264831c6ba8b356
MD5 c04039d8ff8f3102214236e2c34c3bc3
BLAKE2b-256 359a6d9332b2a295a8ad95afc6f80309abe1bd03f552ca059ea67cedb342fb3d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page