Skip to main content

Colored Terminal

* Python support for colored text in terminal
from cterminal import *

your_fg_color = getfgfromrgb(r, g, b)
your_bg_color = getbgfromrgb(r, g, b)
"""@params for getfgfromrbg()/getbgfromrgb()
 - r, g, b:         Required, type(Int)
"""

cprint(style.RED + "test")
"""@params for cprint()
 - string: 			Required (can be multiple strings)
 - separator: 		Optional, default is " "
 - end: 			Optional, default is "\n"
 - file:			Optional, default is sys.stdout
 - flush:			Optional, default is False
"""

cinput(style.RED + "test-input >> ")
"""@params for cinput()
 - prompt:          Required (can be a string concatenate)
"""

# Only for Windows
cmd.setname("name") # Set the window title
cmd.clear() # Clear the terminal
cmd.showcursor() # Hide the cursor
cmd.hidecursor() # Show the cursor
cmd.startcursorblinking() # Start the cursor blinking mode
cmd.stopcursorblinking() # Stop the cursor blinking mode
cmd.createscreenbuffer() # Create a new screen
cmd.switchtomainscreenbuffer() # Switch to the main screen
cmd.movecursor(x, y) # Move the cursor to (x, y) coordinates
cmd.printtoline(line, msg) # Print to the coordinates (line, 0)

Supported

Platform Colors Terminal Tools
Windows Yes Yes
Linux Yes No

Quick multilines printing example

from cterminal import *
import time

cmd.clear()

for i in range(101):
    cmd.printtoline(1, "Progress: " + str(i) + "%")
    cmd.printtoline(2, "Duplicated progress: " + str(i) + "%")
    time.sleep(0.01)

cmd.printtoline(3, "Complete")

Builtin styles

Foreground ...
BLACK BLACK_BRIGHT
RED RED_BRIGHT
GREEN GREEN_BRIGHT
YELLOW YELLOW_BRIGHT
BLUE BLUE_BRIGHT
MAGENTA MAGENTA_BRIGHT
CYAN CYAN_BRIGHT
WHITE WHITE_BRIGHT
Background ...
BG_BLACK BG_BLACK_BRIGHT
BG_RED BG_RED_BRIGHT
BG_GREEN BG_GREEN_BRIGHT
BG_YELLOW BG_YELLOW_BRIGHT
BG_BLUE BG_BLUE_BRIGHT
BG_MAGENTA BG_MAGENTA_BRIGHT
BG_CYAN BG_CYAN_BRIGHT
BG_WHITE BG_WHITE_BRIGHT
Font Style
BOLD
UNDERLINE
REVERSED
Output Params
RESET

Release files for cterminal 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cterminal 1.5.1
File Size Uploaded
cterminal-1.5.1.tar.gz 3.2 kB Details

Release files / cterminal-1.5.1.tar.gz

Download URL cterminal-1.5.1.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
62a1c48fc8f11d3a5806d454620bb5221708308d689afc8690c3bd7eb5b9de6e
BLAKE2b-256 checksum
How to use checksums
ec15a9e3fbc82dc134b78caa6acf315894f846b27af9aac2cb4b16ebbe4514e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.1 requests/2.25.1 setuptools/57.4.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.5.1 This release

1 release file

1.5.0

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.6

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page