Rainbow

From Rosetta Code
Revision as of 17:34, 16 July 2023 by Rorr404 (talk | contribs) (Created page with "{{draft task}} ;Task: Print out the word 'RAINBOW' to the screen with every character being a different color of the rainbow. =={{header|Python}}== ===Colored=== <syntaxhighlight lang="python"> from colored import Fore, Style red: str = f'{Fore.rgb(255, 0, 0)}' orange: str = f'{Fore.rgb(255, 128, 0)}' yellow: str = f'{Fore.rgb(255, 255, 0)}' green: str = f'{Fore.rgb(0, 255, 0)}' blue: str = f'{Fore.rgb(0, 0, 255)}' indigo: str = f'{Fore.rgb(75, 0, 130)}' violet: str =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Rainbow is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task
Print out the word 'RAINBOW' to the screen with every character being a different color of the rainbow.

Python

Colored

from colored import Fore, Style
red: str = f'{Fore.rgb(255, 0, 0)}'
orange: str = f'{Fore.rgb(255, 128, 0)}'
yellow: str = f'{Fore.rgb(255, 255, 0)}'
green: str = f'{Fore.rgb(0, 255, 0)}'
blue: str = f'{Fore.rgb(0, 0, 255)}'
indigo: str = f'{Fore.rgb(75, 0, 130)}'
violet: str = f'{Fore.rgb(128, 0, 255)}'
print(f'{red}R{Style.reset}' + f'{orange}A{Style.reset}' + f'{yellow}I{Style.reset}' + f'{green}N{Style.reset}' + f'{blue}B{Style.reset}' + f'{indigo}O{Style.reset}' + f'{violet}W{Style.reset}')