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.9.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.9-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: visuals-1.2.9.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.9.tar.gz
Algorithm Hash digest
SHA256 68f0fe7eecd66a8b1e89c6ffe6bf289dbf822813e555c3313dc30f11001409b7
MD5 0d4faf6fa475f5747b973ebe6f0bc273
BLAKE2b-256 f97a4d9b0fb976ebf11fe3a174dd52d71a4144a1985b93b9b0636cd8dc031200

See more details on using hashes here.

File details

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

File metadata

  • Download URL: visuals-1.2.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 00aec03266af6368a1828e46abdb046074598396e8fafab611ca03ce2697f5b1
MD5 b6e2d48f53e05ee9e4d7e9efb6ed621a
BLAKE2b-256 29296616ec5cc32bb7e80c1b1a8e9c0d0efff95b236ea543014bb0f099777281

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