staticdata.dev
Menu
Datasets About Contact

xterm 256 Colors

A complete reference of all 256 colors in the xterm terminal color palette, covering the 16 system colors (0–15), the 6×6×6 RGB color cube (16–231), and the 24-step grayscale ramp (232–255). Each entry includes the numeric id, hex code, RGB triplet, and the conventional xterm color name.

Quick fetch

Stable URL. CORS-enabled. No auth.

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

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

Formats

  • JSON 30.0 KB

    /v1/xterm-256-colors.json

    Open

    min: 16.0 KB · /v1/xterm-256-colors.min.json

  • CSV 8.3 KB

    /v1/xterm-256-colors.csv

    Open
  • TypeScript 30.2 KB

    /v1/xterm-256-colors.ts

    export const xterm256Colors

    type XtermColor = (typeof xterm256Colors)[number]

    Open

Schema

Each record in the dataset has the following shape.

Schema
Field Type Description Example
id number Color index (0–255) 196
hex string Uppercase hex color code with # prefix #FF0000
rgb number[] RGB triplet as [r, g, b], each 0–255 [255,0,0]
name string Conventional xterm color name Red1

Preview

First 10 records.

Data preview
idhexname
0#000000Black
1#800000Maroon
2#008000Green
3#808000Olive
4#000080Navy
5#800080Purple
6#008080Teal
7#C0C0C0Silver
8#808080Grey
9#FF0000Red

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

Fetch examples

Drop-in snippets in five languages.

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

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

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

print(xterm256Colors[0])
Go
package main

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

func main() {
	resp, err := http.Get("https://staticdata.dev/v1/xterm-256-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/xterm-256-colors.min.json").call()?.into_string()?;
    let data: Vec<Value> = serde_json::from_str(&body)?;
    println!("{:?}", data.first());
    Ok(())
}

Sources and methodology

The xterm 256-color palette extends the original 8/16 ANSI colors to 256 entries, first introduced by Thomas Dickey’s xterm terminal emulator and subsequently adopted by virtually all modern terminal emulators (iTerm2, GNOME Terminal, Windows Terminal, Alacritty, etc.). Colors are selected using the escape sequence ESC[38;5;<n>m for foreground and ESC[48;5;<n>m for background.

The palette is divided into three logical blocks. Colors 0–15 are the “system” colors whose exact RGB values vary by terminal and are usually overridden by themes; the values used here are the widely reproduced VGA/web-style values (Maroon #800000, Silver #C0C0C0, …), which differ from xterm’s own built-in defaults (e.g. xterm uses #CD0000 for color 1). Colors 16–231 form a 6×6×6 RGB color cube where each channel steps through the values 0, 95, 135, 175, 215, and 255. Colors 232–255 are a uniform grayscale ramp from near-black (#080808) to near-white (#EEEEEE) in 10-unit increments.

The RGB values of colors 16–255 are generated by the same formula as xterm’s 256colres.pl. That script does not name colors; the names are the conventional X11-style names from Jonas Jacek’s widely reproduced 256-color cheat sheet, which is licensed CC BY-SA 4.0 — this dataset is therefore distributed under CC-BY-SA-4.0, and reuse of the names requires attribution to that source. Some names repeat because multiple cube positions map to visually similar or identical hues; the id field is the canonical unique identifier.

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 xterm-256-colors changelog for this dataset's history.

Related datasets

More Code datasets