Skip to main content

colorful-swiss

A Python module focused on creating more colorful and interactive TUIs within the terminal

btopPy dashboard

Requires Windows 10/11 and Python version 3.10+, and a fullscreen terminal for best results.

easy install:

python -m pip install colorful-swiss
python -m colorful_swiss

The second command will open up doc_cmd, an interactive docstring viewer. Type a function's name or id to see what it does or .? to see all of the functions / features of this demo.

The main purpose of this project is to be used as a library / tool:

you can create a new py file with the below code to test it out:

from colorful_swiss import rgb, rainbowify

print(rgb(255, 100, 0) + "orange text" + "\033[0m")
print(rainbowify("super cool rainbow text"))

Features

full list

  • colors - 8 base colors, the 256 color and color based helpers, HSV/HEX/CMYK conversions, gradients
  • a cursor class, and canvas class, and you can read characters and colors off the terminal buffer.
  • finput - keyboard inputs, mouse, esc key, arrows, gamepad controller (w/ deadzones)
  • doc_cmd - a docstring based repl with stylized doc cards, and other tools
  • img, video, GIF, audio rendering - img can be shown via kitty,sixel,colored ascii, and normal ascii

Demos

the tools are the product but the demos show off the tools, for ex (same format):

python -c "from colorful_swiss import donutDemo; donutDemo()"

python -c "from colorful_swiss import btopPy; btopPy()"

python -c "from colorful_swiss import gradientDemo; gradientDemo()"
  • Esc quits donutDemo, rhythmGame, and btopPy.

  • q quits clickDemo and controllerDemo.

  • Tab quits arrowsDemo.

  • gradientDemo ends itself after its 10-second default.

  • Demo - what it does

  1. donutDemo - spinning donut using rgb() and shading
  2. gradientDemo - animated gradient
  3. rhythmGame - a mini game that shows off finput
  4. btopPy - a btop inspired dashboard that looks cool
  5. clickDemo, arrowsDemo, controllerDemo - mouse, arrow, and gamepad input, so just showing off finput.

btopPy is made for larger terminals (170x40 or bigger) and has builtin warning. Some terminals don't support every escape code, and Kitty/Sixel image output needs a terminal that supports those protocols. VS Code's integrated terminal blocks some of the demos, so please use Windows Powershell. Also before running controllerDemo make sure to plug in your controller.

How it works

finput - reads incoming input bytes and adds custom functions, and uses SGR for mouse.

doc_cmd - uses AST for many things and reads the docstring attribute of functions, and uses globals to find said functions.

why btop clone - mainly cause it does good job of showing off every tool in one demo, and looks cool, since I mainly wanted it to look cool I dropped the proc area and network graph and replaced it with a python remake of cava I did and a Matrix rain effect. The CPU panel shows four stats instead of one bar per core: max, median, average, and min. Also disks are capped at 6 so the panel never overflows.

Why is it Windows only

I mainly wanted a Windows library, cause guess what I use windows, but also because Linux has many Tui helpers (due to a lot of linux being in the terminal), while windows doesn't have many. This is also due to the code having to talk to the windows api to get hardware info to make it easier for people to make cool projects with this module.

project files

src/colorful_swiss/
 module.py           main module (colors, cursor, input, canvas, docs browser, demos)
 DataFetcher.py      Windows api and gets hardware info
 displays.py         renders image, GIF, video, and plays audio
 terminal.py         A Markdown renderer
 themeParser.py      theme loader
 spotlight.py        gets Windows Spotlight images
 flipper.py          A Port Demo through Flipper Zero
 clock.py, donut.py  single-file demos
 themes/             Btop's theme folder

Built with

Python, ctypes and pywin32 for the Windows console and hardware APIs, NumPy for the audio FFT, Pillow and OpenCV for image and video rendering, pygame for audio playback, yt-dlp for downloads.

why colorful-swiss:

colorful due to the abundance of color based tools. and swiss due to the swiss army nature of the module

Video (showcases all the demos, optional):

https://www.youtube.com/watch?v=CNtCzBxj1EU&t=11s

Credits

Metadata

Release files for colorful-swiss 0.1.2

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

Source distribution (sdist)

Source distribution for colorful-swiss 0.1.2
File Size Uploaded Provenance Actions
colorful_swiss-0.1.2.tar.gz 80.7 kB Without provenance Details for colorful_swiss-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for colorful-swiss 0.1.2
File Interpreter ABI Platform Actions
colorful_swiss-0.1.2-py3-none-any.whl Python 3 none any Details for colorful_swiss-0.1.2-py3-none-any.whl

Total release size: 197.0 kB

Release files / colorful_swiss-0.1.2.tar.gz

Download URL colorful_swiss-0.1.2.tar.gz
Size 80.7 kB
Tags Source
SHA-256 checksum
How to use checksums
df7af6c5c5aafb1ac4ccb75fbca9482770a8467575688cd95ff0e4e8e5d97bbb
BLAKE2b-256 checksum
How to use checksums
199f947ed30930a7342d762cc9d8a356060eb82cd56181a2420ac3274d395327
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / colorful_swiss-0.1.2-py3-none-any.whl

Download URL colorful_swiss-0.1.2-py3-none-any.whl
Size 116.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb48a0545036b611dd0f225b10d25d4df9f38cca0069c1476adb9b65ea6adba7
BLAKE2b-256 checksum
How to use checksums
210708f07fcac2d146cd947fc9a777e6fd31901c4a5d6bca4e08eea146306eeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for colorful-swiss 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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