PyStyle
PyStyle is a python library to make very beautiful TUI designs.
Inspired by pyfade and pycenter,
Developped by Billy, loTus01, and BlueRed
Install
pip3 install pystyle
Stats: https://pepy.tech/project/pystyle
FEATURES IN THE DOC
- Colorate text ✔️
- Colorate text with fade effect ✔️
- Animations ❌
- Writing effects ✔️
- Centered Text ✔️
- Adding banners ✔️
- Make boxes ✔️
- Hide and Show Cursor ✔️
- System Functions ✔️
Colorate text
Colorate some text easily.
from pystyle import Colors, Colorate
text = "Hello world!"
print(Colors.blue + text)
# or
print(Colorate.Color(Colors.blue, text, True))
Colors.blue = color
text = text to be colored
True = end the coloring after (otherwise it will continue printing characters in the specified color)
Available functions are:
- Color (simply colorate a text)
- Error (make an error effect easily)
Colorate text with fade effect
Make a fade effect.
from pystyle import Colors, Colorate
print(Colorate.Horizontal(Colors.yellow_to_red, "Hello, Welcome to Pystyle.", 1))
Colors.yellow_to_red = color
Colorate.Vertical = mode
1 = intensity (default=1)
Available effects are:
- Vertical
- Horizontal
- Diagonal
- DiagonalBackwards
Writing text with fade effect
To print a text with a writing and fade effect you can use the pystyle.Write function.
from pystyle import Write, Colors
name = Write.Input("Enter your name -> ", Colors.red_to_purple, interval=0.0025)
Write.Print(f"Nice to meet you, {name}!", Colors.blue_to_green, interval=0.05)
There are 2 functions:
Write.Print: prints the text to the terminal with chosen effects
Write.Input: same than Write.Print but adds an input at the end
There are 6 arguments:
text: the text to be written to the terminal
color: the color you want for the text
interval: the interval of the writing effect
hide_cursor: whether you want the cursor to be hidden or not
end: the end color, the default is white
input_color (only for Write.Input): the color of the input
Center text
Center a text in the terminal.
from pystyle import Center
print(Center.XCenter("Hello, Welcome to Pystyle."))
Output:
Hello, Welcome to Pystyle.
Available modes are:
- Center (Center the banner/text on both axis)
- XCenter (Center the banner/text on X axis)
- YCenter (Center the banner/text on Y axis)
Adding banners
Add a banner to another easily.
from pystyle import Add
banner1 = '''
.--.
.'_\/_'.
'. /\ .'
"||"
|| /\
/\ ||//\)
(/\\||/
____\||/____'''
text = "This is a beautiful banner\nmade with pystyle"
print(Add.Add(banner1, text, 4))
Output:
.--.
.'_\/_'.
'. /\ .'
"||" This is a beautiful banner
|| /\ made with pystyle
/\ ||//\)
(/\||/
____\||/____
banner1 = first banner
text = second banner
4 = blank lines before adding the smallest banner to the biggest banner (default=0). Set to True to center it
Make boxes
Make beautiful boxes easily!
from pystyle import Box
print(Box.Lines("Hello, Welcome to Pystyle."))
print(Box.DoubleCube("Hello, Welcome to Pystyle."))
Output:
─══════════════════════════☆☆══════════════════════════─
Hello, Welcome to Pystyle.
─══════════════════════════☆☆══════════════════════════─
╔════════════════════════════╗
║ Hello, Welcome to Pystyle. ║
╚════════════════════════════╝
Available modes are:
- Lines
- SimpleCube
- DoubleCube
Cursor
Show cursor!
from pystyle import Cursor
Cursor.ShowCursor()
Hide cursor!
from pystyle import Cursor
Cursor.HideCursor()
System functions
Check the terminal support colors
from pystyle import System
System.Init()
Clear the terminal screen
from pystyle import System
System.Clear()
Change the terminal title
from pystyle import System
System.Title("The title")
Notice: this feature only work on windows
Change terminal size
Notice This feature is only working on windows
from pystyle import System
System.Size(12,12)
Run a shell command
from pystyle import System
System.Command("echo hello")
👤 Authors
👤 GitHub: @billythegoat356
👤 GitHub: @loTus01
👤 GitHub: @BlueRed
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
❤ Show your support
Give a ⭐️ if this project helped you!
评论