Looking for turnkey demos? See
docs/examples/ansi-conversion/for scripts that wrap the commands below.
Convert a single ANSI file:
.\Convert-AnsiToColorScript.ps1 -AnsiFile "myart.ans"Convert all .ans files in a directory:
Get-ChildItem -Path "C:\ANSI-Art" -Filter "*.ans" | .\Convert-AnsiToColorScript.ps1.\Convert-AnsiToColorScript.ps1 -AnsiFile "art.ans" -OutputFile "my-custom-script.ps1".\Convert-AnsiToColorScript.ps1 -AnsiFile "art.ans" -AddComment# See detailed information about conversion process
.\Convert-AnsiToColorScript.ps1 -AnsiFile "art.ans" -Verbose
# Example outputs:
# VERBOSE: Detected single-line ANSI file with cursor positioning - converting to multi-line format
# VERBOSE: Detected 80-column wrapped ANSI file - splitting into multiple lines
# VERBOSE: Detected multi-line ANSI file with some long lines - wrapping at 80 columns.\Convert-AnsiToColorScript.ps1 -AnsiFile "art.ans" -OutputDirectory ".\CustomScripts"- Reads the ANSI file - Uses CP437 (DOS/OEM) encoding to properly handle box-drawing and extended ASCII characters
- Converts to Unicode - Preserves all ANSI escape sequences and special characters
- Wraps in PowerShell - Creates a script using
Write-Host @"..."@syntax - Saves to Scripts folder - Automatically places in ColorScripts-Enhanced/Scripts
- Auto-naming - Converts filename to lowercase with hyphens (PowerShell convention)
The converter supports standard ANSI art files (.ans) which contain:
- ANSI escape sequences for colors (e.g.,
\x1b[31mfor red) - Box-drawing characters
- Extended ASCII/CP437 characters
- Cursor positioning codes
Some ANSI files don't use traditional newlines. The converter automatically detects and converts these formats:
Files that use cursor positioning commands instead of newlines:
ESC[1;1HRed TextESC[2;1HGreen TextESC[3;1HBlue Text
Red Text
Green Text
Blue Text
ESC[row;colHorESC[row;colf- Move cursor to positionESC[nB- Move cursor down n linesESC[nC- Move cursor forward n columns
Files where all content is on one long line meant to wrap every 80 visible characters:
████████...████ ▄▄ ▄▄▄...▄▄ ██ ██ ▀ ▄...▄ ▀ ██...
████████...████
██ ▄▄ ▄▄▄...▄▄ ██
██ ▀ ▄...▄ ▀ ██
Files with multiple lines where some individual lines exceed 80 characters:
Normal line (75 chars)
Very long line exceeding 80 chars that needs wrapping... (160 chars)
Another normal line (60 chars)
Normal line (75 chars)
Very long line exceeding 80 chars that needs wrapping... (first 80)
(continuation of long line)
Another normal line (60 chars)
Detection: The converter checks each line and wraps any line with >100 visible characters.
The converter counts only visible characters - ANSI escape codes don't count toward the 80-character width.
# Input: dragon.ans
# Output: dragon.ps1 (in ColorScripts-Enhanced/Scripts)
.\Convert-AnsiToColorScript.ps1 -AnsiFile "dragon.ans"Get-ChildItem "*.ans" | ForEach-Object {
.\Convert-AnsiToColorScript.ps1 -AnsiFile $_.FullName -AddComment
}# View the ANSI file first (in PowerShell 7+)
Get-Content "art.ans" -Raw | Write-Host
# If it looks good, convert it
.\Convert-AnsiToColorScript.ps1 -AnsiFile "art.ans"- Preview ANSI files - Use
Get-Content -Raw | Write-Hostto preview first - UTF-8 Encoding - Make sure your ANSI files are UTF-8 encoded
- File Naming - The script auto-converts names to PowerShell conventions
- Batch Processing - Use pipeline for converting multiple files
- Test Output - Run the generated .ps1 file to verify it looks correct
This happens when ANSI files using CP437 (DOS) encoding are incorrectly read as UTF-8. The fix is to re-convert the file:
# Re-convert with proper encoding support (included in latest version)
.\Convert-AnsiToColorScript.ps1 -AnsiFile "yourfile.ans" -OutputFile "yourfile.ps1"- Traditional ANSI art uses Code Page 437 (CP437) encoding
- CP437 includes special box-drawing characters in bytes 128-255
- These characters must be properly converted to Unicode for PowerShell
- The converter now automatically handles this conversion
- Ensure the ANSI file uses standard escape sequences
- Check that your terminal supports 256-color or true color
- Try viewing in Windows Terminal for best results
- If you see
�or??: Re-convert the file (see above) - Verify your terminal font supports Unicode box-drawing characters
- Recommended fonts: CascadiaCode Nerd Font, FiraCode Nerd Font, JetBrains Mono Nerd Font
- Check if the source .ans file contains actual content
- Some ANSI files may have non-printing control characters only
Popular sources for ANSI art files:
- 16colo.rs - Large collection of ANSI/ASCII art
- textfiles.com - Vintage BBS art archives
- ANSI art communities and forums
- Convert your own images using tools like:
- img2txt (libcaca)
- jp2a
- ascii-image-converter
Once converted, your scripts will:
- Be automatically discovered by
Get-ColorScriptList - Work with
Show-ColorScript -Name your-script - Be cached for fast loading with
New-ColorScriptCache - Support all ColorScripts-Enhanced features
# 1. Download or create ANSI art
# 2. Convert to PowerShell
.\Convert-AnsiToColorScript.ps1 -AnsiFile "cool-art.ans" -AddComment
# 3. Test it
Show-ColorScript -Name cool-art
# 4. Build cache for performance
New-ColorScriptCache -Name cool-art
# 5. List all your scripts
Get-ColorScriptList -Name cool-artThe converted scripts work seamlessly with ColorScripts-Enhanced:
# Import the module
Import-Module ColorScripts-Enhanced
# Your converted ANSI art is now available
Show-ColorScript -Name dragon
# Add to your profile for startup
Add-ColorScriptProfile -ScriptName dragonFor ANSI files that are too tall to display comfortably, use Split-AnsiFile.js:
# Preview suggested splits without writing files (looks for 4+ blank rows)
node scripts/Split-AnsiFile.js .\we-ACiDTrip.ANS --auto --dry-run
# Generate three 300-line chunks as PowerShell scripts
node scripts/Split-AnsiFile.js .\we-ACiDTrip.ANS --heights=300,300,300
# Emit ANSI slices instead of .ps1 wrappers
node scripts/Split-AnsiFile.js .\we-ACiDTrip.ANS --format=ansi --breaks=420,840
# Split an already converted colorscript
node scripts/Split-AnsiFile.js .\ColorScripts-Enhanced\Scripts\we-acidtrip.ps1 --input=ps1 --heights=320,320
# Split every 160 lines automatically
node scripts/Split-AnsiFile.js .\we-ACiDTrip.ANS --every=160--auto- Adds breaks where large blank gaps exist--heights/--breaks- Enforce manual cut points--every=<n>- Evenly divides the render--strip-space-bg- (ANSI input only) Clears background colors on plain spaces--dry-run- Preview without writing files
Each output chunk is normalized with a trailing ESC[0m so the terminal resets cleanly after display.
The repository includes additional helpers for developers:
Generate-ReleaseNotes.ps1- Wraps git-cliff to build PowerShell Gallery release notesValidate-Changelog.ps1- Checks CHANGELOG.md matches manifest versionInvoke-MarkdownLinkCheck.ps1- Validates all markdown links
See the npm Scripts Reference for complete details on development utilities.