Rainbow Print adds colors to the standard outputs to ease the process of monitoring respective data / metrics
Project description
Rainbow Print
Inspired by Rainbow CSV - Rainbow Print adds colors to the standard outputs to ease the process of monitoring respective data / metrics
Main features
- Highlights data points in different colors to ease monitoring capabilities
- By default provides 7 colors (light and dark each) for N Variables(rolling). Supports N colors
- Support for Dark and Light backgrounds
- Supports string print based on separator / dictionary's key-value based print
- Supports custom colors based on
sty.fg
package - Supports use of python logging frameword for advance usecases
Demo
How rainbow print helps
Default print a dictionary of metrics for 10 steps
Default print a string of metrics for 10 steps
Rainbow Print - Dark Mode
Rainbow Print - Light Mode
Requirements
- python >3
- sty
Installation
pip install rainbow-print
Usage
# Print
from rainbow_print import printr
data = {"Episode": 10, "Episode Len":5, "Cost": 0.95, "Reward":135, "Mode":"Explore"}
printr(data)
data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
printr(data, sep=',')
# Logging
from rainbow_print import rlogging
logger = rlogging.getLogger(__name__)
data = {"Episode": 10, "Episode Len":5, "Cost": 0.95, "Reward":135, "Mode":"Explore"}
logger.info(data)
data = f"Episode:{10}, Episode Len:{5}, Cost:{0.95}, Reward:{135}, Mode:{'Explore'}"
logger.debug(data, sep=',')
# Get information regarding current configuration
printr.info()
>>Theme: dark
>>Colors: ['\x1b[38;2;5;152;154m', '\x1b[38;2;116;162;103m', '\x1b[38;2;179;128;168m', '\x1b[38;2;255;127;0m', '\x1b[38;2;112;154;180m', '\x1b[38;2;255;255;0m', '\x1b[38;2;255;0;0m']
Configuration
# By default printr works in dark mode
from rainbow_print import printr
# Switch to light palette
printr.set_light_palette()
# Switch to dark palette
printr.set_dark_palette()
# Set colors for dark palette
colors = [sty.fg(0,0,0), sty.fg(255,255,255)]
printr.update_dark_palette(colors)
# Set colors for light palette
colors = [sty.fg(0,0,0), sty.fg(255,255,255)]
printr.update_light_palette(colors)
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
rainbow-print-1.0.5.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for rainbow_print-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09607b38a09ee0653be9b3719dd029626c7716451492d28f6e27defd0d5b422a |
|
MD5 | 4a0f28961c91c62a27173661bc06e62b |
|
BLAKE2b-256 | f1323f43ddd76df0452c11ac06ff9b79ed77851e9badea7da6d847a798cc6544 |