Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/billythegoat356/pystyle

The source of my Python library, pystyle.
https://github.com/billythegoat356/pystyle

animatoin cli colorama colors fade pip py pypi python tui

Last synced: 1 day ago
JSON representation

The source of my Python library, pystyle.

Awesome Lists containing this project

README

        

PyStyle





Version

Documentation


Maintenance


License: EPL-2.0


Downloads

> **PyStyle** is a python library to make very beautiful TUI designs.
>

> Inspired by **pyfade** and **pycenter**,
>

> Developped by [Billy](https://github.com/billythegoat356), [loTus01](https://github.com/loTus04), and [BlueRed](https://github.com/CSM-BlueRed)

## Install

```sh
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.



```python
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.



```python
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.

```python
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.

```python
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.


```python
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!



```python
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!

```python
from pystyle import Cursor

Cursor.ShowCursor()
```

Hide cursor!

```python
from pystyle import Cursor

Cursor.HideCursor()
```

## System functions
### Check the terminal support colors
```python
from pystyle import System

System.Init()
```
### Clear the terminal screen
```python
from pystyle import System

System.Clear()
```
### Change the terminal title
```python
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

```python
from pystyle import System

System.Size(12,12)
```
### Run a shell command
```python
from pystyle import System

System.Command("echo hello")
```




## 👤 Authors

👤 GitHub: [@**billythegoat356**](https://github.com/billythegoat356)

👤 GitHub: [@**loTus01**](https://github.com/loTus04)

👤 GitHub: [@**BlueRed**](https://github.com/CSM-BlueRed)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/billythegoat356/pystyle/issues).

## ❤ Show your support

Give a ⭐️ if this project helped you!

***