Skip to main content

Create beautiful and colorful designs for your terminal applications

Project description

visuals


Version Documentation Maintenance License: Apache-2.0 Downloads

visuals is a Python library used for implementing beautiful, colorful styling into your terminal applications.
It is based on pystyle, pyfade, pycenter and pybanner.

Install

pip install visuals

Features

  • Colored text ✔️
  • Colored text with a fade effect ✔️
  • Writing effects ✔️
  • Centered text ✔️
  • Adding banners ✔️
  • Make boxes ✔️
  • Hide and show cursor ✔️
  • Change window title ✔️
  • System functions ✔️

Colored text

Color some text easily.


from visuals 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 = reset color after (otherwise it will continue printing characters in the specified color)


Available functions are:

  • Color (simply color some text)
  • Error (make an error effect)

Colored text with fade effect

Make a fade effect.


from visuals import Colors, Fade
print(Fade.Horizontal(Colors.yellow_to_red, "Hello, Welcome to visuals.", 1))

Colors.yellow_to_red = color
Fade.Vertical = mode
1 = intensity (default=1)


Available effects are:

  • Vertical
  • Horizontal
  • Diagonal
  • DiagonalBackwards

Writing text with fade effect


To print a text using writing and fade effect you can use the visuals.Write function.

from visuals 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 as 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 visuals import Center
print(Center.XCenter("Hello, Welcome to visuals."))

Output:


                                            Hello, Welcome to visuals.                                

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 text to a banner easily.

from visuals import Add
banner1 = '''
    .--.
  .'_\/_'.
  '. /\ .'
    "||"
     || /\
  /\ ||//\)
 (/\\||/
____\||/____'''

text = "This is a beautiful banner\nmade with visuals"

print(Add.Add(banner1, text, 4))

Output:

    .--.
  .'_\/_'.
  '. /\ .'
    "||"    This is a beautiful banner
     || /\  made with visuals
  /\ ||//\)
 (/\||/
____\||/____

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 visuals import Box
print(Box.Lines("Hello, Welcome to visuals."))
print(Box.DoubleCube("Hello, Welcome to visuals."))

Output:

─══════════════════════════☆☆══════════════════════════─
               Hello, Welcome to visuals.
─══════════════════════════☆☆══════════════════════════─
╔════════════════════════════╗
║ Hello, Welcome to visuals. ║
╚════════════════════════════╝

Available modes are:

  • Lines
  • SimpleCube
  • DoubleCube

Cursor

Show cursor!

from visuals import Cursor

Cursor.ShowCursor()

Hide cursor!

from visuals import Cursor

Cursor.HideCursor()

System functions

Check if the terminal supports colors

from visuals import System

System.Init()

Clear the terminal screen

from visuals import System

System.Clear()

Change the terminal title (Windows-only)

from visuals import System

System.Title("The title")

Change terminal size (Windows-only)

from visuals import System

System.Size(12,12)

Run a shell command

from visuals import System

System.Command("echo hello")


Contributions, issues and feature requests are welcome!


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

visuals-1.2.7.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

visuals-1.2.7-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file visuals-1.2.7.tar.gz.

File metadata

  • Download URL: visuals-1.2.7.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for visuals-1.2.7.tar.gz
Algorithm Hash digest
SHA256 a28a96d7fb4bd7a7fdfe2a63a0cd0793124cefd8456ad913cdc6fba21158f613
MD5 cebf09949314e30bb111e5df01081cb3
BLAKE2b-256 90dc40a74dc93c5448e05ddd953ec767adbc1554526acac3c5cf2c0643893c9d

See more details on using hashes here.

File details

Details for the file visuals-1.2.7-py3-none-any.whl.

File metadata

  • Download URL: visuals-1.2.7-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for visuals-1.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f334af58845c8e7501ce1f50faf789d23bb5874fd0471c97607df6f10237f1ea
MD5 db9d660f2aa8ad621189f786435a3b92
BLAKE2b-256 650790fdbd94d7fe320df20dc5439c4ef7e98e9a10478ec01e7623bb9dbc84d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page