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.
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
min: 16.0 KB · /v1/xterm-256-colors.min.json
- CSV 8.3 KB
/v1/xterm-256-colors.csv
- TypeScript 30.2 KB
/v1/xterm-256-colors.ts
export const xterm256Colors
type XtermColor = (typeof xterm256Colors)[number]
Schema
Each record in the dataset has the following shape.
| 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.
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/xterm-256-colors.json | jq '.[0]' 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]); 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]) 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])
} 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
- ascii
- 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