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.
Quick fetch
Stable URL. CORS-enabled. No auth.
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
min: 6.4 KB · /v1/ansi-colors.min.json
- CSV 3.9 KB
/v1/ansi-colors.csv
- TypeScript 8.2 KB
/v1/ansi-colors.ts
export const ansiColors
type AnsiColor = (typeof ansiColors)[number]
Schema
Each record in the dataset has the following shape.
| 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.
| code | name | category | description |
|---|---|---|---|
| 0 | Reset | reset | Reset / Normal — turn off all attributes |
| 1 | Bold | style | Bold or increased intensity |
| 2 | Dim | style | Faint / dim — decreased intensity (not supported by every terminal) |
| 3 | Italic | style | Italic text (supported by most modern terminals; some older terminals render it as inverse instead) |
| 4 | Underline | style | Single underline |
| 5 | Blink Slow | style | Slow blink — less than 150 blinks per minute |
| 6 | Blink Rapid | style | Rapid blink — 150+ blinks per minute (not widely supported) |
| 7 | Reverse Video | style | Swap foreground and background colors |
| 8 | Conceal | style | Hidden / concealed text (not widely supported) |
| 9 | Strikethrough | style | Crossed-out / strikethrough text |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/ansi-colors.json | jq '.[0]' 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]); 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]) 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])
} 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
- cron-presets
- css-at-rules
- css-functions
- css-properties
- css-pseudo-classes
- css-pseudo-elements
- css-units
- data-units
- exit-codes
- file-signatures
- hash-algorithms
- js-array-methods
- js-math-methods
- js-object-methods
- js-string-methods
- json-schema-keywords
- jwt-claims
- mathematical-constants
- measurement-units
- node-builtin-modules
- owasp-top-10
- periodic-table
- physical-constants
- posix-signals
- programming-languages
- regex-flags
- regex-patterns
- roman-numerals
- si-base-units
- si-derived-units
- si-prefixes
- spdx-licenses
- strftime-tokens
- tailwind-colors
- time-units
- unicode-blocks
- unicode-general-categories
- unicode-planes
- unix-file-permissions
- xterm-256-colors