examples/ANSI Color Test/README.md
This example demonstrates Serial Studio's comprehensive ANSI color and VT-100 terminal emulation support.
\033[38;5;Nm\033[48;5;Nm\033[38;2;R;G;Bm\033[48;2;R;G;BmConfigure Serial Studio:
Enable ANSI Colors:
Run the complete test script with all color tests:
python3 test_ansi_colors.py
The script will send a comprehensive suite of ANSI color and VT-100 test sequences to Serial Studio via UDP. Watch the console pane to see:
You can also run individual test sections:
# Display 16-color ANSI palette
python3 test_ansi_colors.py --16colors
# Display 256-color palette
python3 test_ansi_colors.py --256colors
# Display simple color boxes
python3 test_ansi_colors.py --boxes
# Display RGB gradients
python3 test_ansi_colors.py --gradients
# Show help message
python3 test_ansi_colors.py --help
The script connects to localhost:9000 via UDP and sends formatted test sequences. Each test section includes:
\033[38;5;206m)\033[30m Black \033[90m Bright Black
\033[31m Red \033[91m Bright Red
\033[32m Green \033[92m Bright Green
\033[33m Yellow \033[93m Bright Yellow
\033[34m Blue \033[94m Bright Blue
\033[35m Magenta \033[95m Bright Magenta
\033[36m Cyan \033[96m Bright Cyan
\033[37m White \033[97m Bright White
\033[40m Black BG \033[100m Bright Black BG
\033[41m Red BG \033[101m Bright Red BG
\033[42m Green BG \033[102m Bright Green BG
\033[43m Yellow BG \033[103m Bright Yellow BG
\033[44m Blue BG \033[104m Bright Blue BG
\033[45m Magenta BG \033[105m Bright Magenta BG
\033[46m Cyan BG \033[106m Bright Cyan BG
\033[47m White BG \033[107m Bright White BG
\033[38;5;Nm Set foreground to color N (0-255)
\033[48;5;Nm Set background to color N (0-255)
Color ranges:
\033[38;2;R;G;Bm Set foreground to RGB(R, G, B)
\033[48;2;R;G;Bm Set background to RGB(R, G, B)
Where R, G, B are values from 0-255.
Multiple codes can be combined with semicolons:
\033[31;47m Red text on white background
\033[1;32m Bold green text
\033[38;5;206;48;5;57m 8-bit pink on blue
\033[38;2;255;82;197;48;2;155;106;0m RGB pink on brown
\033[0m Reset all attributes (color, bold, etc.)
When you run the test, you should see colorful output in the Serial Studio console like:
╔════════════════════════════════════════════════════════════╗
║ 4-BIT COLOR TESTS (Standard ANSI) ║
╚════════════════════════════════════════════════════════════╝
Red (\033[31m)
Green (\033[32m)
Blue (\033[34m)
...
Each color will be rendered in its actual color, with backgrounds displaying behind text.
You can modify test_ansi_colors.py to:
localhost:9000)Serial Studio's ANSI color implementation: