Package: colorist
🌈 Colorist for Python 🌈Lightweight Python package that makes it easy and fast to print colored text in the terminal.Ready to try? Seehow to install.Getting StartedPrint Line of Colored TextHow to print a full line of colored text in the terminal:fromcoloristimportgreen,yellow,redgreen("This is GREEN!")yellow("This is YELLOW!")red("This is RED!")How it appears in the terminal:Print Mixed Text ColorsHow to customize colors inside a paragraph and print it in the terminal:fromcoloristimportColorprint(f"I want{Color.RED}red{Color.OFF}color inside this paragraph")print(f"Both{Color.GREEN}green{Color.OFF}and{Color.YELLOW}yellow{Color.OFF}are nice colors")How it appears in the terminal:Other Styling OptionsPrint Bright ColorsMost terminals support bright colors that stand more out:fromcoloristimportBrightColorprint(f"I want{BrightColor.CYAN}cyan{BrightColor.OFF}color inside this paragraph")How it appears in the terminal:Remember to useColor.OFForBrightColor.OFFevery time you want to revert back to the default terminal text style. Otherwise, the color may spill over and into other terminal messages.Print Background Colorsfromcoloristimportbg_green,bg_yellow,bg_redbg_green("This is GREEN background!")bg_yellow("This is YELLOW background!")bg_red("This is RED background!")How it appears in the terminal:Background colors can also be mixed inside a paragraph:fromcoloristimportBgColorprint(f"I want{BgColor.RED}red{BgColor.OFF}background color inside this paragraph")print(f"Both{BgColor.GREEN}green{BgColor.OFF}and{BgColor.YELLOW}yellow{BgColor.OFF}are nice background colors")How it appears in the terminal:fromcoloristimportBgBrightColorprint(f"I want{BgBrightColor.CYAN}cyan{BgBrightColor.OFF}background color inside this paragraph")How it appears in the terminal:As with text colors, remember to useBgColor.OFForBgBrightColor.OFFevery time you want to revert back to the default terminal text style. Otherwise, the color may spill over and into other terminal messages.Foreground TextColorFull Text FunctionCustomExamplegreen("text")Color.GREENyellow("text")Color.YELLOWred("text")Color.REDmagenta("text")Color.MAGENTAblue("text")Color.BLUEcyan("text")Color.CYANwhite("text")Color.WHITEblack("text")Color.BLACK--Color.DEFAULT---Color.OFF-bright_green("text")BrightColor.GREENbright_yellow("text")BrightColor.YELLOWbright_red("text")BrightColor.REDbright_magenta("text")BrightColor.MAGENTAbright_blue("text")BrightColor.BLUEbright_cyan("text")BrightColor.CYANbright_white("text")BrightColor.WHITEbright_black("text")BrightColor.BLACK--BrightColor.DEFAULT---BrightColor.OFF-BackgroundColorFull Text FunctionCustomExamplebg_green("text")BgColor.GREENbg_yellow("text")BgColor.YELLOWbg_red("text")BgColor.REDbg_magenta("text")BgColor.MAGENTAbg_blue("text")BgColor.BLUEbg_cyan("text")BgColor.CYANbg_white("text")BgColor.WHITEbg_black("text")BgColor.BLACK--BgColor.DEFAULT---BgColor.OFF-bg_bright_green("text")BgBrightColor.GREENbg_bright_yellow("text")BgBrightColor.YELLOWbg_bright_red("text")BgBrightColor.REDbg_bright_magenta("text")BgBrightColor.MAGENTAbg_bright_blue("text")BgBrightColor.BLUEbg_bright_cyan("text")BgBrightColor.CYANbg_bright_white("text")BgBrightColor.WHITEbg_bright_black("text")BgBrightColor.BLACK--BgBrightColor.DEFAULT---BgBrightColor.OFF-Thank You for SupportingDonateThis module is free to use. And if you like it, feel free tobuy me a coffee.ContributeIf you have suggestions or changes to the module, feel free to add to the code and create apull request.Report BugsReport bugs and issueshere.3-Clause BSD LicenseCopyright (c) 2022 – present, Jakob BagterpRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.