Skip to Content

What are the ansi color names?

Colors play an important role in how we perceive and interact with the world. When working with technology and computer systems, colors are represented in different coded formats to display properly on screens. One popular color coding system is the ANSI (American National Standards Institute) color set which defines standard names and numeric values for colors.

In this article, we will explore what ANSI color names are, their history and purpose, and provide a complete reference list of the ANSI color names and values. Whether you are a programmer looking to stylize terminal output, a designer seeking color codes for web development, or just interested in color systems for technology, read on to learn all about ANSI color names!

What Are ANSI Color Names?

ANSI color names are standardized names for specific colors defined by the ANSI standard. ANSI colors originate from the ANSI X3.64 standard which was established in 1979 to provide a consistent set of names and codes for text colors and styles on computer terminals and displays.

Instead of using vague color descriptions like “red” or “blue”, ANSI color names allow for precise, universally recognized colors to be called out. For example, the ANSI name “red” actually refers specifically to a vivid red color with an exact hex value of #FF0000.

The ANSI color set originally defined 8 colors in 1979. Over time the standard expanded to include a total of 16 named colors. Each ANSI color name such as “cyan” or “magenta” is defined with an exact red, green, and blue (RGB) hexadecimal color value. This allows the colors to be accurately and consistently displayed across different mediums.

Brief History of ANSI Colors

The ANSI X3.64 standard was developed by the American National Standards Institute (ANSI) in 1979 as a way to standardize text formatting and colors for computer terminals. At the time, early computer terminal displays were very limited in how they could render colored text and graphics. The ANSI standard helped unify the color options across terminals from different vendors and operating systems.

The first version of the standard defined 8 original color names and values including “black”, “red”, “green”, “yellow”, “blue”, “magenta”, “cyan”, and “white”. These could be accessed using ANSI escape codes which allowed Terminals to change text colors on the fly by sending these coded instructions.

In 1986, ANSI X3.64 was updated to expand the set to 16 total colors. The new additions included color names like “bright black”, “bright green”, and “bright yellow”. These new colors extended the range of available colors by specifying brighter, more vivid versions of the original 8 ANSI colors.

Although we have more advanced color generation capabilities today, ANSI color codes continue to be widely used and supported across operating systems and computing applications. The color set is well suited for command line interfaces, configuration files, web development, programming, and more. The standard color values provide a reliable way to convey colors on screens.

Purpose and Uses of ANSI Colors

ANSI color names serve several key purposes:

  • Standardization – They provide a standardized set of color names that have precise definitions across all systems.
  • Readability – The color names are specific and easy to identify at a glance, improving readability.
  • Compatibility – The ANSI colors are widely supported and compatible across terminals, browsers, code, and apps.
  • Control – Names allow colors to be changed and controlled programmatically via code instructions.
  • Stylization – Applying different ANSI colored text can help stylize and customize terminal output and code.

Today, ANSI color names are still very relevant and useful in many coding and technology contexts:

  • Command line interface output styling
  • Terminal emulators and text UIs
  • Developer console messages
  • Web page styling with CSS
  • Configuration files and syntax highlighting
  • Coding string and variable color formatting
  • Printing colored text with programming languages

The widespread support for ANSI codes across programming languages and platforms makes them a dependable method for conveying color in tech applications.

Complete ANSI Color Names and Values Reference

Here is a complete reference table of all 16 ANSI color names, their hexadecimal RGB values, and decimal code numbers:

Color Name Hex Value Decimal Code
Black #000000 30
Red #FF0000 31
Green #00FF00 32
Yellow #FFFF00 33
Blue #0000FF 34
Magenta #FF00FF 35
Cyan #00FFFF 36
White #FFFFFF 37
Bright Black #808080 90
Bright Red #FF0000 91
Bright Green #00FF00 92
Bright Yellow #FFFF00 93
Bright Blue #0000FF 94
Bright Magenta #FF00FF 95
Bright Cyan #00FFFF 96
Bright White #FFFFFF 97

The hex values define the precise red, green, and blue mix (each on a 00 to FF scale) that makes up the final visible color. The decimal codes are used in programming ANSI escape sequences to set text color.

For example, the code “&#033[31m” would set text color to red by using the ANSI escape sequence for color (033[) plus the decimal code for red (31). This allows color changes to be scripted programatically in code.

How to Use ANSI Colors

There are a few different ways to implement ANSI color codes depending on your needs:

Terminal Output

In Linux, UNIX, or other terminal environments, you can use ANSI escape sequences to colorize text output. For example:

echo -e "\033[31mThis text is red\033[0m"

The \033[31m turns on red text color, and \033[0m resets the color back to default.

Web Development

For web and HTML, the hex color values can be used directly in CSS:

h1 {
  color: #FF0000; /* ANSI Red */
}

You can also use the CSS color name variables available in modern browsers:

h1 {
  color: var(--ansi-red); 
}

Programming

Most programming languages like Python, JavaScript, C++ have ANSI color formatting built in or available via libraries. For example:

// Python
print('\033[31m' + 'Hello in red!') 

// JavaScript
console.log('\x1b[31m%s\x1b[0m', 'Hello in red!');

Consult each language’s documentation for the best way to use ANSI colors.

Benefits of ANSI Colors

Using ANSI color names and codes provides the following notable benefits:

  • Readability – Named colors like “yellow” are far more readable than hex codes.
  • Compatibility – ANSI colors work across nearly all systems and languages.
  • Control – ANSI escape sequences allow programmatic color control.
  • Standardization – Defined colors avoid guesswork and mismatched values.
  • Retro Computing Support – Great for vintage terminal emulation and retro programming.

By relying on ANSI color names and codes, you can avoid inconsistencies and hassles when working with color across platforms. The standardization ensures colors translate correctly and can be integrated smoothly across web, software, and computing applications.

Conclusion

ANSI color names and codes continue to be a relevant and useful standard for managing color in technology. The defined ANSI colors provide a reliable, widely supported way to convey precise colors across terminals, operating systems, programming, web pages, and virtually any digital medium.

Whether you need to stylize a console output, highlight syntax, control colors programmatically, or match values to a spec, the ANSI colors have you covered. The self-explanatory color names paired with universal hex and decimal codes make it straightforward to integrate ANSI colors into any project or workflow.

So next time you need to spice up a command line, style a web page, or add some color to an application UI, don’t reinvent the wheel – lean on the trusted ANSI color standard!