Live Style Editor
This page contains a live editor for rich-click styles.
At the bottom of the page, there is generated code for the sample output.
The style options here are not exhaustive! There are many more ways to customize your rich-click outputs. Modern terminals also support more than the 8 colors used on this page; see here for more information about terminal colors. The Live Style Editor seeks to represent a useful subset of the available styling options.
Option | Color | Other styles |
---|---|---|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Usage: docs [OPTIONS] FOO COMMAND [ARGS]... Help text for CLI Second line of help text. --bar -b Lorem ipsum [default: (someval)] * --baz Choose wisely [required] --help Show this message and exit. ╭─ Commands ───────────────────────────────────────────────────────────╮ │ subcommand Help text for subcommand │ ╰──────────────────────────────────────────────────────────────────────╯
import rich_click as click
help_config = click.RichHelpConfiguration(
style_option="bold cyan",
style_argument="bold cyan",
style_command="bold cyan",
style_switch="bold green",
style_metavar="",
style_metavar_separator="",
style_usage="bold yellow",
style_usage_command="bold ",
style_helptext_first_line="",
style_helptext="dim",
style_option_default="",
style_required_short="red",
style_required_long="dim red",
style_options_panel_border="",
style_commands_panel_border="dim"
)
@click.group("my-command")
@click.argument("foo")
@click.option("--bar", "-b", help="Lorem ipsum", show_default="someval")
@click.option("--baz", required=True, help="Choose wisely", type=click.Choice(["a", "b", "c"]))
@click.rich_config(help_config=help_config)
def cli(foo, bar):
"""
Help text for CLI
Second line of help text.
"""
@cli.command("subcommand")
def subcommand(foo, bar):
"""Help text for subcommand"""
if __name__ == "__main__":
cli()
import rich_click as click
click.rich_click.STYLE_OPTION = "bold cyan"
click.rich_click.STYLE_ARGUMENT = "bold cyan"
click.rich_click.STYLE_COMMAND = "bold cyan"
click.rich_click.STYLE_SWITCH = "bold green"
click.rich_click.STYLE_METAVAR = ""
click.rich_click.STYLE_METAVAR_SEPARATOR = ""
click.rich_click.STYLE_USAGE = "bold yellow"
click.rich_click.STYLE_USAGE_COMMAND = "bold"
click.rich_click.STYLE_HELPTEXT_FIRST_LINE = ""
click.rich_click.STYLE_HELPTEXT = "dim"
click.rich_click.STYLE_OPTION_DEFAULT = ""
click.rich_click.STYLE_REQUIRED_SHORT = "red"
click.rich_click.STYLE_REQUIRED_LONG = "dim red"
click.rich_click.STYLE_OPTIONS_PANEL_BORDER = ""
click.rich_click.STYLE_COMMANDS_PANEL_BORDER = "dim"
@click.group("my-command")
@click.argument("foo")
@click.option("--bar", "-b", help="Lorem ipsum", show_default="someval")
@click.option("--baz", required=True, help="Choose wisely", type=click.Choice(["a", "b", "c"]))
def cli(foo, bar):
"""
Help text for CLI
Second line of help text.
"""
@cli.command("subcommand")
def subcommand(foo, bar):
"""Help text for subcommand"""
if __name__ == "__main__":
cli()