Package: termspark
InstallationpipinstalltermsparkUsageprint(), but more!Import Termspark's print and take advantage of all its features,colors,highlights,styles,hyperlinksand more ...fromtermsparkimportprintprint(" Termspark ","white","blue","italic")print(" [@termspark](https://github.com/faissaloux/termspark) ","black","white","italic, bold")You can choose from["left", "center", "right"]to specify where to print by passing it as position parameter:print(" Termspark ", position="center").You can enable the Full Width using full_width parameter:print(" Termspark ", highlight="blue", full_width=True).You can fill the empty space by a character usingprint(separator=).fromtermsparkimportprintprint(" TERMSPARK ","white","green",position="center",separator="_")input()input with colors, highlights, styles, and hyperlinks.Withinput(position=)you can specify position where to put your input text["left", "center", "right"].
Withinput(full_width=)you can enable full widthTrue | False.fromtermsparkimportinputname=input(" What's your name? ","white","blue","italic","center",True)Input TypeYou can specify the input type by passing it to thetype=parameter.For a calculation example, to pass the input value into a calculation you don't need to convert it tointanymore, you just need to set it fromtypeargument 🥳 .fromtermsparkimportinputbirthyear=input(" Your year birth? ","white","blue",type=int)print(f"Your age is:{2023-birthyear}")Input Callbacktheinput()supports callback too.If you need to pass the input value into some function before returning the result, you need to pass it into thecallback=argument.fromtermsparkimportinputdefage_calc(birthyear,currentyear=2023):returncurrentyear-birthyearage=input(" Your year birth? ","white","blue",type=int,callback=age_calc)print(f"Your age is:{age}")You can use separator ininput(separator=)too.fromtermsparkimportinputname=input(" What's your name?","white","blue",position="left",separator=".")line()To print empty line useline(), you can leave it empty or fill it with a repeated character, you can specify its color too.fromtermsparkimportlineline(".","blue")line(highlight="green")line()line("-")More controlfromtermsparkimportTermSparkTermSpark().print_right('RIGHT').spark()TermSpark().spark_right('RIGHT').spark()TermSpark().print_left('LEFT').spark()TermSpark().spark_left('LEFT').spark()TermSpark().print_center('CENTER').spark()TermSpark().spark_center('CENTER').spark()TermSpark().line('.').spark()TermSpark().print_left('LEFT').print_right('RIGHT').set_separator('.').spark()TermSpark().print_left('LEFT').print_center('CENTER').print_right('RIGHT').set_separator('.').spark()TermSpark().spark_left('LEFT').spark_center('CENTER').spark_right('RIGHT').set_separator('.').spark()NoteSeparator can contain only one character.You can also paint your contentSupported colors:blackredgreenyellowbluemagentacyanwhitegray / greylight redlight greenlight yellowlight bluelight magentalight cyanfromtermsparkimportTermSparkTermSpark().print_right('RIGHT','blue').spark()TermSpark().print_left('LEFT','light red').spark()TermSpark().print_center('CENTER','light_green').spark()Supported highlights:blackredgreenyellowbluemagentacyanwhitegray / greylight redlight greenlight yellowlight bluelight magentalight cyanfromtermsparkimportTermSparkTermSpark().print_right('RIGHT',None,'light_magenta').spark()TermSpark().print_left('LEFT','red','white').spark()TermSpark().print_center('CENTER','white','light blue').spark()You can use different styles on same positionfromtermsparkimportTermSparkTermSpark().spark_left([' * ','gray','white'],[' Info ','white','blue']).spark()TermSpark().spark_center([' * ','gray','white'],[' Warning ','white','yellow']).spark()TermSpark().spark_right([' * ','gray','white'],[' Error ','white','red']).spark()You know you can use them all together 😉Lines are too long to write a termspark line! 😑fromtermsparkimportTermSparkTermSpark().spark_left([' * ','gray','white'],[' Info ','white','blue']).spark_center([' * ','gray','white'],[' Warning ','white','yellow']).spark_right([' * ','gray','white'],[' Error ','white','red']).spark()You can separate them by calling each function in a line 🤤fromtermsparkimportTermSparktermspark=TermSpark()termspark.spark_left([' * ','gray','white'],[' Info ','white','blue'])termspark.spark_center([' * ','gray','white'],[' Warning ','white','yellow'])termspark.spark_right([' * ','gray','white'],[' Error ','white','red'])termspark.spark()Still too long 🙄 Got you 🤩fromtermsparkimportTermSparktermspark=TermSpark()termspark.spark_left([' * ','gray','white'])termspark.spark_left(' Info ','white','blue')termspark.spark_center([' * ','gray','white'])termspark.spark_center([' Warning ','white','yellow'])termspark.spark_right(' * ','gray','white')termspark.spark_right([' Error ','white','red'])termspark.spark()RawYou can print raw version which is colors-code-free so you can print clean text into files for example.fromtermsparkimportTermSparkraw=TermSpark().print_left('LEFT').print_right('RIGHT').set_separator('.').raw()Force WidthYou can customize width instead of the default full terminal width.fromtermsparkimportTermSparkTermSpark().set_width(40).print_left("LEFT","red").print_right("RIGHT","blue").spark()Set content max widthYou can specify max width of content depending on position usingmax_[position](max_characters).fromtermsparkimportTermSparktermspark=TermSpark()termspark.spark_left(["LEFT","red"])termspark.spark_right(["RIGHT","blue"])termspark.max_left(2)termspark.max_right(3)termspark.spark()This should show only "LE" on the left, and "RIG" on the right.Warningmax_[position]()is only supported by sparkers.Full widthYou can enable full width by usingfull_width().fromtermsparkimportTermSparktermspark=TermSpark()termspark.spark_center(['Thanks for using Termspark!','white','green'])termspark.full_width()termspark.spark()Warningfull_width()can only be used with one position.SeparatorYou can add color and highlight to separator too usingset_separator(content, color, highlight).termspark=TermSpark()termspark.spark_left([' Author ','green'])termspark.spark_right([' Faissal Wahabali ','green'])termspark.set_separator('.','green')termspark.spark()LineYou can add highlight a line by usingline(highlight=highlight).termspark=TermSpark()termspark.line(highlight='green')termspark.spark()StyleYou can style your text by passing it toprint() style parameteror tospark([]) fourth list element.Supported styles:bolddimitalicoverlineunderlinedouble underlinestrike throughblinkreversehiddenNoteYou can mix styles by separating them by commas.termspark=TermSpark()termspark.print_center(' Termspark ','green',style='underline, overline, italic')termspark.full_width()termspark.spark()HyperlinksYou can insert hyperlink using Markdown[TEXT](LINK).termspark=TermSpark()termspark.spark_left([" Author ","green"])termspark.spark_right([" [@faissaloux](https://github.com/faissaloux) ","green"])termspark.set_separator(".","green")termspark.spark()