Diving into the world of computer programming often involves navigating a plethora of commands and codes. Among these, the American National Standard Institute (ANSI) color codes play a significant role in adding color and vibrancy to the otherwise monochromatic text-based interfaces in consoles and terminal applications. If you're eager to liven up your command-line experience,TORF you've come to the right place.

In this comprehensive guide, we'll explore the ANSI color codes list and guide you on how to apply these colors in your bash scripts or any other terminal-based applications. So, let's get started and brighten up that dull console!

Understanding ANSI Color Codes
ANSI color codes are a set of numeric codes that correspond to specific colors. These codes are understood by terminal emulators and allow users to print colored text and background in their console output. The codes are based on the original ANSI standard, which defined eight basic colors.

Before we dive into the detailed codes, let's first understand the syntax to use these codes: `
ANSI 30 and 40 Series: Basic Colors

The 30-series codes represent the basic eight colors, while the 40-series codes represent their respective backgrounds. Here's a brief overview of these basic colors:
| Color Code | Color |
|---|---|
| 30 | Black |
| 31 | Red |
| 32 | Green |
| 33 | Yellow |
| 34 | Blue |
| 35 | Magenta |
| 36 | Cyan |
| 37 | White |
| 40 | Black background |
| 47 | White background |
For instance, to print text in red, you'd use `

ANSI 90 Series: Bright Colors
In addition to the basic colors, ANSI also defined a brighter version of each color using the 90-series codes. These bright colors provide more vibrant alternatives to their darker counterparts. Here's a list of these bright colors:
- 90 - Bright black (white with atransfer)
- 91 - Bright red
- 92 - Bright green
- 93 - Bright yellow
- 94 - Bright blue
- 95 - Bright magenta
- 96 - Bright cyan
- 97 - Bright white

To use these bright colors, simply replace the basic color codes with their corresponding bright code. For example, `
Resetting Colors and Other Formatting




















After introducing color to your console output, you might want to return to the default color. This can be achieved using the code `
- 1 - Activate bold mode
- 4 - Underline mode
- 7 - Reverse video mode (swaps foreground and background colors)
To use these formatting codes, simply replace `
With this comprehensive list of ANSI color codes, you're now equipped to add color and vibrancy to your terminal-based applications. Happy coding, and don't forget to have fun exploring and incorporating these colors into your projects!