colors.py
This file
Path
examples/colors/colors.py
39 lines · 926 bytes · Python
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 9ce34f2 point at it.
Make faqs section. Add the first question about windows shell expansion. (#2927)Rowlando13before adoption9ce34f2
lines 1–39why, one step back1import click234all_colors = (5 "black",6 "red",7 "green",8 "yellow",9 "blue",10 "magenta",11 "cyan",12 "white",13 "bright_black",14 "bright_red",15 "bright_green",16 "bright_yellow",17 "bright_blue",18 "bright_magenta",19 "bright_cyan",20 "bright_white",21)222324@click.command()25def cli():26 """This script prints some colors. It will also automatically remove27 all ANSI styles if data is piped into a file.2829 Give it a try!30 """31 for color in all_colors:32 click.echo(click.style(f"I am colored {color}", fg=color))33 for color in all_colors:34 click.echo(click.style(f"I am colored {color} and bold", fg=color, bold=True))35 for color in all_colors:36 click.echo(click.style(f"I am reverse colored {color}", fg=color, reverse=True))3738 click.echo(click.style("I am blinking", blink=True))39 click.echo(click.style("I am underlined", underline=True))