Package: termstrap
termstrapa css file (Bootstrap like) for unicode text formatting in python console output :)USAGEInstall it using pip:pip install termstrapImport in your code:import cssorfrom css import Bootstrap, printc.Create an object:text = Bootstrap()Use as:text.colorize(<string>, <color>)ortext.stylize(<string>, < b / i / u >)ortext.start_block(<color>, <formatter>)Accessible functions/methodsSimple ones :colorize(): Takes a text, font color(optional) and bgcolor(optional).stylize(): Takes a text, style name (bold, italics, underline and blink). Passing only initials work (e.g. 'b' for bold). You can pass multiple styles simultaneously.INFO: blink is experimental, if it doesn't work, it does not break anything! Therefore no shorthand for it!Lil advanced ones:get_color(): Takes name of a font color and returns its color codeget_bgcolor(): Takes name of a background color and returns its color codenew_color(): Takes a color name and color code. Can be used to add a new custom font color entrynew_bgcolor(): Takes a color name and color code. Can be used to add a new custom background color entryWARNING: Only usenew_color()ornew_bgcolor()if you know what you are doing!Accessible VariablesAll colors can be accessed by the class instance. Overwriting them will/may break functionality.Color variables: Bootstrap names - primary, danger, warning, etc.Background color variables: bg_primary, bg_danger, bg_warning, etc.Style variables: bold, italics, underline, selected, blinkMore Utility FunctionsTHESE ARE NOT MEMBERS OF BOOTSTRAP CLASS. NO NEED FOR INSTANCE CREATION. just import and use.printc: Like standard print(). Except: Does not have flush and file params. Have color param, takes name of the color. style param, takes a list or tuple of all styles. bgcolor param, takes name of the bgcolor!hide_cursor: Hides cursor in the consoleshow_cursor: Restores cursor visibility.ExamplefromcssimportBootstrap,printc# make sure you have downloaded the css.py file in the same folder/directorytext=Bootstrap()# Using colorize to colorprint(text.colorize("THIS IS RED","red"))# You can also use Bootstrap classes, eg. dangerprint(text.colorize("THIS IS blue","primary"))# blue will also work.# Using stylize to format text- bold(b), italics(i), underline(u), selected(s), blinkprint(text.stylize("A BOLD move","bold"))# b also works in place of boldprint(text.stylize("Slightly slanted","i"))print(text.stylize("More the merrier",'b','u','s','i'))# You can also combine colors and formats:print(text.stylize(text.colorize("This is bold in red"),'b'))# Change color for multiple lines if needed!text.start_block('red',bold=True)# Any text in this clock will be printed in RED, and BOLD by defaulttext.end_block()# Using the printcprintc("RED text in *BOLD*",color='red',style=('b'))printc("[1,2,3,4]",color='warning',style=('b','u'),sep='***')# yellow text, styled bold and underlined, seperated by - ***printc("a","b","cdf",color="primary",end='')# print multiple strings and specify end param as none, ie. no newline at end!IMPORTANT: Info is not the same color as bootstrap info, its violet!KNOWN ISSUESStyle - blink DOES NOT work in most cases.Windows cmd only supports color in windows 10 (v1511 onwards)!INSPIRATIONThisstackoverflow was the inspiration for this project.