staticdata.dev
Menu
Datasets About Contact

ANSI Color Codes

The 56 most widely used ANSI Select Graphic Rendition (SGR) parameter codes used in terminal escape sequences. Covers the 8 standard foreground colors (30–37), 8 standard background colors (40–47), 8 bright foreground variants (90–97), 8 bright background variants (100–107), the extended-color introducers (38, 48), text-styling attributes (bold, italic, underline, blink, overline, etc.), and reset codes.

v1.0.0 MIT 56 records Updated 2026-10-05 stable Source:  ECMA-48: Control Functions for Coded Character Sets, Wikipedia: ANSI escape code

Quick fetch

Stable URL. CORS-enabled. No auth.

bash
curl https://staticdata.dev/v1/ansi-colors.json

Or use as a typed import: import { ansiColors } from "https://staticdata.dev/v1/ansi-colors.ts"

Formats

  • JSON 8.1 KB

    /v1/ansi-colors.json

    Open

    min: 6.4 KB · /v1/ansi-colors.min.json

  • CSV 3.9 KB

    /v1/ansi-colors.csv

    Open
  • TypeScript 8.2 KB

    /v1/ansi-colors.ts

    export const ansiColors

    type AnsiColor = (typeof ansiColors)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
Field Type Description Example
code number SGR parameter number (e.g. 31 for red foreground) 31
name string Human-readable name of the code Red
category string One of: foreground, background, style, reset foreground
description string Plain-language description of what the code does Foreground color: red

Preview

First 10 records.

Data preview
codenamecategorydescription
0ResetresetReset / Normal — turn off all attributes
1BoldstyleBold or increased intensity
2DimstyleFaint / dim — decreased intensity (not supported by every terminal)
3ItalicstyleItalic text (supported by most modern terminals; some older terminals render it as inverse instead)
4UnderlinestyleSingle underline
5Blink SlowstyleSlow blink — less than 150 blinks per minute
6Blink RapidstyleRapid blink — 150+ blinks per minute (not widely supported)
7Reverse VideostyleSwap foreground and background colors
8ConcealstyleHidden / concealed text (not widely supported)
9StrikethroughstyleCrossed-out / strikethrough text

Showing 10 of 56. View full data:  JSON · CSV

Fetch examples

Drop-in snippets in five languages.

curl
curl -sSL https://staticdata.dev/v1/ansi-colors.json | jq '.[0]'
JavaScript
import type { AnsiColor } from "https://staticdata.dev/v1/ansi-colors.ts";

const res = await fetch("https://staticdata.dev/v1/ansi-colors.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const ansiColors: AnsiColor[] = await res.json();
console.log(ansiColors[0]);
Python
import urllib.request, json

with urllib.request.urlopen("https://staticdata.dev/v1/ansi-colors.min.json") as r:
    ansiColors = json.load(r)

print(ansiColors[0])
Go
package main

import (
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	resp, err := http.Get("https://staticdata.dev/v1/ansi-colors.min.json")
	if err != nil { panic(err) }
	defer resp.Body.Close()

	var data []map[string]any
	if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
		panic(err)
	}
	fmt.Println(data[0])
}
Rust
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let body = ureq::get("https://staticdata.dev/v1/ansi-colors.min.json").call()?.into_string()?;
    let data: Vec<Value> = serde_json::from_str(&body)?;
    println!("{:?}", data.first());
    Ok(())
}

Sources and methodology

ANSI escape codes are byte sequences embedded in text streams to control terminal display attributes such as color and formatting. The Select Graphic Rendition (SGR) subset — introduced in ECMA-48 and supported by virtually every modern terminal emulator — is triggered by the sequence ESC[<n>m, where <n> is one of the parameter codes in this dataset.

This dataset covers the core SGR codes most widely used in practice: the 8 standard foreground colors (30–37), their 8 bright variants (90–97), the 8 standard background colors (40–47), their 8 bright variants (100–107), default-color reset codes (39, 49), the extended-color introducers 38 and 48 (followed by 5;<n> for a 256-color palette index or 2;<r>;<g>;<b> for 24-bit color), text-style attributes (bold, dim, italic, underline, blink, reverse video, conceal, strikethrough, overline), and their corresponding off codes. Code 0 resets all attributes to defaults. Rarely used parameters (alternative fonts 10–20, framed/encircled 51–52, ideogram attributes 60–65, underline color 58/59) are not included.

The bright colors 90–97 and 100–107 are not part of ECMA-48; they originated in IBM’s aixterm and are now supported by virtually all terminal emulators.

Note that rendering varies across terminal emulators: “bright” colors may be rendered by increasing luminosity, applying bold, or mapping to a distinct palette entry depending on the terminal and its configuration. Codes 2 (dim), 3 (italic), 5/6 (blink), 8 (conceal) and 53 (overline) are not universally supported.

Versioning

URLs under /v1/ are stable: field names and types will not change in a way that breaks consumers. Values can be corrected or records added when the upstream source changes; schema-incompatible updates ship under a new version path. See the ansi-colors changelog for this dataset's history.

Related datasets

More Code datasets