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.1.tar.gz (13.8 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.1-py2.py3-none-any.whl (15.1 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for colorforms-1.0.1.tar.gz
Algorithm Hash digest
SHA256 45a8e3225904c0d25038a3a26723070ea292363c5cb41c5beb8a4906f7d6dfcf
MD5 f877a2804a9f203bde5c00aea0d3ad20
BLAKE2b-256 985ff50856606248ad8bd642c45f2d855010ad3a8f51f02de879332d6aceb1be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: colorforms-1.0.1-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.13.3

File hashes

Hashes for colorforms-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5fe1ffa791d9e50affe1fc6a19476d8269358294ded8cba3e8f8b223e0ffb746
MD5 6f04f31a4dad6e5b34032d094a359fec
BLAKE2b-256 8684c73565cf5c56678d080e0848ebd02502579a56122c0b421f16919bfe5e79

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