Skip to main content
Version: 0.1.0

Format and Style

Text formatting and styling components for beautiful terminal output.

Format

Format and render text as markdown, code, emoji, or templates.

Basic Usage

echo "# Hello World" | invowk tui format --type markdown

Options

OptionDescription
--typeFormat type: markdown, code, emoji, template
--languageLanguage for code highlighting
--themeGlamour theme for code highlighting

Markdown

Render markdown with colors and formatting:

# From stdin
echo "# Heading\n\nSome **bold** and *italic* text" | invowk tui format --type markdown

# From file
cat README.md | invowk tui format --type markdown

Code Highlighting

Syntax highlight code:

# Specify language
cat main.go | invowk tui format --type code --language go

# Python
cat script.py | invowk tui format --type code --language python

# JavaScript
cat app.js | invowk tui format --type code --language javascript

Emoji Conversion

Convert emoji shortcodes to actual emojis:

echo "Hello :wave: World :smile:" | invowk tui format --type emoji
# Output: Hello 👋 World 😄

Real-World Examples

Display README

cat README.md | invowk tui format --type markdown

Show Code Diff

git diff | invowk tui format --type code --language diff

Welcome Message

echo ":rocket: Welcome to MyApp :sparkles:" | invowk tui format --type emoji

Style

Apply terminal styling to text.

Basic Usage

invowk tui style --foreground "#FF0000" "Red text"

Options

OptionDescription
--foregroundText color (hex or name)
--backgroundBackground color
--boldBold text
--italicItalic text
--underlineUnderlined text
--strikethroughStrikethrough text
--faintDimmed text
--blinkBlinking text
--reverseReverse colors
--borderBorder style
--padding-*Padding (left, right, top, bottom)
--margin-*Margin (left, right, top, bottom)
--widthFixed width
--heightFixed height
--alignText alignment: left, center, right

Colors

Use hex colors or names:

# Hex colors
invowk tui style --foreground "#FF0000" "Red"
invowk tui style --foreground "#00FF00" "Green"
invowk tui style --foreground "#0000FF" "Blue"

# With background
invowk tui style --foreground "#FFFFFF" --background "#FF0000" "White on Red"

Text Decorations

# Bold
invowk tui style --bold "Bold text"

# Italic
invowk tui style --italic "Italic text"

# Combined
invowk tui style --bold --italic --underline "All decorations"

# Dimmed
invowk tui style --faint "Subtle text"

Piping

Style text from stdin:

echo "Important message" | invowk tui style --bold --foreground "#FF0000"

Borders

Add borders around text:

# Simple border
invowk tui style --border normal "Boxed text"

# Rounded border
invowk tui style --border rounded "Rounded box"

# Double border
invowk tui style --border double "Double border"

# With padding
invowk tui style --border rounded --padding-left 2 --padding-right 2 "Padded"

Border styles: normal, rounded, double, thick, hidden

Layout

# Fixed width
invowk tui style --width 40 --align center "Centered"

# With margins
invowk tui style --margin-left 4 "Indented text"

# Box with all options
invowk tui style \
--border rounded \
--foreground "#FFFFFF" \
--background "#333333" \
--padding-left 2 \
--padding-right 2 \
--width 50 \
--align center \
"Styled Box"

Real-World Examples

Success/Error Messages

# Success
echo "Build successful!" | invowk tui style --foreground "#00FF00" --bold

# Error
echo "Build failed!" | invowk tui style --foreground "#FF0000" --bold

# Warning
echo "Deprecated feature" | invowk tui style --foreground "#FFA500" --italic

Headers and Sections

# Main header
invowk tui style --bold --foreground "#00BFFF" "=== Project Setup ==="
echo ""

# Subheader
invowk tui style --foreground "#888888" "Configuration Options:"

Status Boxes

# Info box
invowk tui style \
--border rounded \
--foreground "#FFFFFF" \
--background "#0066CC" \
--padding-left 1 \
--padding-right 1 \
"Info: Server is running on port 3000"

# Warning box
invowk tui style \
--border rounded \
--foreground "#000000" \
--background "#FFCC00" \
--padding-left 1 \
--padding-right 1 \
"Warning: API key will expire soon"

In Scripts

{
name: "status"
description: "Show system status"
implementations: [{
script: """
invowk tui style --bold --foreground "#00BFFF" "System Status"
echo ""

# Check services
if systemctl is-active nginx > /dev/null 2>&1; then
echo "nginx: " | tr -d '\n'
invowk tui style --foreground "#00FF00" "running"
else
echo "nginx: " | tr -d '\n'
invowk tui style --foreground "#FF0000" "stopped"
fi

if systemctl is-active postgresql > /dev/null 2>&1; then
echo "postgres: " | tr -d '\n'
invowk tui style --foreground "#00FF00" "running"
else
echo "postgres: " | tr -d '\n'
invowk tui style --foreground "#FF0000" "stopped"
fi
"""
runtimes: [{name: "native"}]
platforms: [{name: "linux"}, {name: "macos"}]
}]
}

Combined Patterns

Formatted Output

# Header
invowk tui style --bold --foreground "#FFD700" "Package Info"
echo ""

# Render package description as markdown
cat package.md | invowk tui format --type markdown

Interactive with Styled Output

NAME=$(invowk tui input --title "Project name:")

if invowk tui confirm "Create $NAME?"; then
invowk tui spin --title "Creating..." -- mkdir -p "$NAME"
echo ""
invowk tui style --foreground "#00FF00" --bold "Created $NAME successfully!"
else
invowk tui style --foreground "#FF0000" "Cancelled"
fi

Next Steps