Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Shell
  3. ansi

ansi

NOASSERTIONShell

A pure Bash script to generate ANSI escape codes for terminal text styling, cursor control, and display manipulation.

GitHubGitHub
809 stars59 forks0 contributors

What is ansi?

ANSI is a pure Bash script that generates ANSI escape sequences for terminal manipulation. It allows developers to change text colors, move the cursor, apply text attributes (like bold or underline), and control display elements directly from shell scripts or command lines. It solves the problem of adding rich terminal styling without relying on external tools or complex libraries.

Target Audience

Shell script developers and system administrators who need to enhance terminal output with colors, dynamic cursor positioning, or basic UI elements in Bash environments.

Value Proposition

Developers choose ANSI because it's lightweight, dependency-free, and written entirely in Bash, making it highly portable. It offers a comprehensive set of terminal control features without the overhead of larger libraries like ncurses.

Overview

ANSI escape codes in pure bash - change text color, position the cursor, much more

Use Cases

Best For

  • Adding colorized output to Bash scripts for better readability
  • Creating dynamic progress indicators or spinners in terminal applications
  • Building simple interactive CLI tools with cursor positioning
  • Enhancing shell prompts with colors and custom attributes
  • Debugging terminal behavior by querying cursor position or window size
  • Writing portable scripts that work across systems with only Bash installed

Not Ideal For

  • Projects requiring complex terminal UI with widgets or menus like those in ncurses
  • Environments where PowerShell or non-Bash shells are the primary scripting language
  • Scripts that must run on terminals with minimal or no ANSI escape sequence support, such as basic serial consoles
  • Applications demanding high-speed, real-time terminal updates where Bash overhead might be too slow

Pros & Cons

Pros

Pure Bash Dependency-Free

Uses only Bash built-ins, ensuring compatibility across systems where Bash is available, as emphasized in the Philosophy section and installation notes.

Comprehensive Terminal Control

Offers extensive options for text styling, cursor movement, display manipulation, and terminal reporting, covering colors, attributes, and queries like window size.

Library and CLI Flexibility

Can be used as both a command-line tool and sourced as a Bash library with mirrored functions, allowing for programmatic control in scripts.

Helpful Color Previews

Includes built-in options like --color-table and --color-codes to visualize available colors and codes, making it easier to choose styles.

Cons

Terminal Dependency Issues

Not all features work on all terminals, and support varies, leading to inconsistent behavior; the README explicitly warns about this.

Breaking Changes History

The project reversed its newline handling in August 2018, causing upgrade issues and potential confusion for existing users, as noted in the Upgrading Issues section.

Manual Installation Required

Installation involves downloading and manually placing the script in the PATH or using BPM, which is more cumbersome than standard package managers.

Limited Error Handling

Reporting features require stdin to be available and may fail silently on unsupported terminals, as mentioned in the Reporting section.

Frequently Asked Questions

Quick Stats

Stars809
Forks59
Contributors0
Open Issues0
Last commit4 years ago
CreatedSince 2014

Tags

#shell-scripting#terminal#cli-tool#ansi-escape-codes#bash#terminal-ui#cursor-control#command-line

Built With

B
Bash

Included in

Shell36.8k
Auto-fetched 4 hours ago

Related Projects

the-art-of-command-linethe-art-of-command-line

Master the command line, in one page

Stars160,832
Forks14,803
Last commit1 year ago
shellcheckshellcheck

ShellCheck, a static analysis tool for shell scripts

Stars39,371
Forks1,914
Last commit29 days ago
bash-guidebash-guide

A guide to learn bash

Stars12,265
Forks1,044
Last commit1 year ago
shsh

A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt

Stars8,712
Forks397
Last commit12 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub