import rich.console import rich.text import cowsay # need to pip install cowsay for this # Define the message message = "Taste the rainbow! 🌈" # python supports unicode # Generate the cow speech bubble cow_speech = cowsay.get_output_string("cow", message) # that's a string # Use 'rich' to print with rainbow gradients rainbow_message = rich.text.Text() # the colors in the rainbow colors = ["red", "yellow", "green", "cyan", "blue", "magenta"] # use a different rainbow color for every character for i, char in enumerate(cow_speech): rainbow_message.append(char, style=colors[i % len(colors)]) # print the rainbow-styled cow speech to the console console = rich.console.Console() console.print(rainbow_message)