Skip to main content

click-help-colors

PyPI PyPI - Downloads

Colorization of help messages in Click.

Usage

import click
from click_help_colors import HelpColorsGroup, HelpColorsCommand

@click.group(
    cls=HelpColorsGroup,
    help_headers_color='yellow',
    help_options_color='green'
)
def cli():
    pass

@cli.command()
@click.option('--count', default=1, help='Some number.')
def command1(count):
    click.echo('command 1')

@cli.command(
    cls=HelpColorsCommand,
    help_options_color='blue'
)
@click.option('--name', help='Some string.')
def command2(name):
    click.echo('command 2')
$ python example.py --help
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/1.png
$ python example.py command1 --help
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/2.png
$ python example.py command2 --help
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/3.png
import click
from click_help_colors import HelpColorsGroup, HelpColorsCommand

@click.group(
    cls=HelpColorsGroup,
    help_headers_color='yellow',
    help_options_color='green',
    help_options_custom_colors={'command3': 'red', 'command4': 'cyan'}
)
def cli():
    pass


@cli.command(
    cls=HelpColorsCommand,
    help_headers_color=None,
    help_options_color=None,
    help_options_custom_colors={'--count': 'red', '--subtract': 'green'}
)
@click.option('--count', default=1, help='Count help text.')
@click.option('--add', default=1, help='Add help text.')
@click.option('--subtract', default=1, help='Subtract help text.')
def command1(count, add, subtract):
    """A command"""
    click.echo('command 1')

...
$ python example_with_custom_colors.py --help
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/4.png
$ python example_with_custom_colors.py command1 --help
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/5.png
from click_help_colors import version_option

@click.group()
def cli():
    pass

@cli.command()
@version_option(
    version='1.0',
    prog_name='example',
    message_color='green'
)
def cmd1():
    pass

@cli.command()
@version_option(
    version='1.0',
    prog_name='example',
    version_color='green',
    prog_name_color='yellow'
)
def cmd2():
    pass

@cli.command()
@version_option(
    version='1.0',
    prog_name='example',
    version_color='green',
    prog_name_color='white',
    message='%(prog)s %(version)s\n   python=3.7',
    message_color='bright_black'
)
def cmd3():
    pass
https://raw.githubusercontent.com/click-contrib/click-help-colors/master/examples/screenshots/6.png

Installation

With pip:

$ pip install click-help-colors

From source:

$ git clone https://github.com/click-contrib/click-help-colors.git
$ cd click-help-colors
$ python setup.py install

Metadata

Release files for click-help-colors 0.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for click-help-colors 0.9.4
File Size Uploaded Provenance Actions
click-help-colors-0.9.4.tar.gz 8.0 kB Without provenance Details for click-help-colors-0.9.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for click-help-colors 0.9.4
File Interpreter ABI Platform Actions
click_help_colors-0.9.4-py3-none-any.whl Python 3 none any Details for click_help_colors-0.9.4-py3-none-any.whl

Total release size: 14.5 kB

Release files / click-help-colors-0.9.4.tar.gz

Download URL click-help-colors-0.9.4.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f4cabe52cf550299b8888f4f2ee4c5f359ac27e33bcfe4d61db47785a5cc936c
BLAKE2b-256 checksum
How to use checksums
6f5076f51d9c7fcd72a12da466801f7c1fa3884424c947787333c74327b4fcf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / click_help_colors-0.9.4-py3-none-any.whl

Download URL click_help_colors-0.9.4-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b33c5803eeaeb084393b1ab5899dc5476c7196b87a18713045afe76f840b42db
BLAKE2b-256 checksum
How to use checksums
99f88768f803151714640cb6f06fd9de490ce7db632d351da05f42f77330d2fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for click-help-colors 0.9.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page