Open-source project
termstandard/colors avatar
termstandard/colors

termstandard/colors: A Practical Guide to Terminal Color Standards

Color standards for terminal emulators

1,509 stars63 forksUnknownUnlicense

At a glance

What is it?
termstandard/colors is a reference for terminal color modes, TrueColor detection, and palette behavior. It helps application developers choose between environment checks and terminal queries, while documenting the limits of ANSI escape sequences.
Who is it for?
Adopt termstandard/colors as a reference when implementing terminal color support, especially for detection across sudo, SSH, and older terminals. Do not treat it as a complete compatibility database or a replacement for testing in the target environment.
Can I use it commercially?
Yes. Unlicense is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 77 days ago.
What is it written in?
GitHub does not report a main language for this repository.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Why termstandard/colors exists for terminal application developers

termstandard/colors addresses a practical problem: terminal programs and terminal emulators do not expose color support through one uniform interface. The README distinguishes plain ASCII without color controls, ANSI escape sequences, the 256-color palette, and 24-bit TrueColor. It is aimed at developers who need to select a color representation, detect terminal capabilities, or troubleshoot a mismatch between an application and an emulator.

The distinction matters because the modes have different limits. The README describes the 256-color palette as 16 initial colors, a 6x6x6 color cube, and a 24-level gray scale. The palette has a standardized initial arrangement, but its entries can be reprogrammed separately. A terminal can therefore display 24-bit RGB colors through this mode, but only 256 distinct colors can be present at once. TrueColor is described as a 256x256x256 RGB cube, with no corresponding palette restriction.

This is documentation, not a terminal emulator implementation. The repository contains LICENSE and README.md, and the README does not present an API, package installation command, or runtime service. Its value is in giving developers a shared vocabulary and a set of tests and response patterns before they add color output to software.

ANSI modes and the README's direct TrueColor test

The README explains that ANSI escape sequences can express several color modes. It lists 8 colors with bright and dim foreground variants, 16 colors with corresponding bright versions, a 256-color palette, and 24-bit TrueColor. It also notes that both semicolons and colons can be used as control-sequence delimiters, although it says this behavior is supported only by xterm and Konsole according to the Wikipedia reference cited there.

The repository gives a small shell test for Xterm-style TrueColor. It assigns the background selector, foreground selector, and RGB values, then prints a marker through a TrueColor escape sequence. The expected visible result is the word TRUECOLOR in brown when the terminal understands the sequence.

bash
fgbg=48 # background
fgbg=38 # foreground
red=255
green=102
blue=0
printf '\e[%u;2;%u;%u;%um%s\e[m\n' "$fgbg" "$red" "$green" "$blue" TRUECOLOR

The test is a rendering check, not a capability negotiation protocol. It can show that an emulator displays the requested color, but the README also shows why a more interactive query can be needed when an application needs a yes-or-no result.

COLORTERM detection and the limits of environment variables

The README documents a simpler detection route based on the COLORTERM environment variable. VTE, Konsole, and iTerm2 can set COLORTERM=truecolor. The S-Lang library checks whether COLORTERM contains either truecolor or 24bit, using a case-sensitive comparison. Terminfo has supported the 24-bit TrueColor capability as RGB since ncurses-6.0-20180121, with setaf for foreground colors and setab for background colors.

The repository is direct about the weakness of this method. COLORTERM is separate from TERM and is not forwarded by default through sudo or SSH. An application can therefore see support advertised in a local shell but not after entering another environment. The README says checking COLORTERM is recommended because it is safer than claiming support when it is absent, and because an application can fall back to 8-bit color.

The README lists three configuration locations that can improve forwarding: SendEnv in /etc/ssh/ssh_config, AcceptEnv in /etc/ssh/sshd_config, and env_keep in /etc/sudoers. It also provides a shell-startup example that sets COLORTERM for known terminal types. This is a fallback approach, not proof that every matching terminal actually implements TrueColor correctly.

Interactive terminal queries for reliable capability checks

For an interactive program that can read terminal responses, the README describes a more reliable method. The program sends a TrueColor escape sequence that sets a background color, then sends a DECRQSS query asking which color is active. If the response reports the same RGB values, the terminal appears to support TrueColor and the colon delimiter.

The documented example uses RGB(1,2,3), described as an unlikely default value, because a matching response is more informative than a common color value. The sample response includes the terminal's acknowledgment of the request and the requested color. The README contrasts this with a terminal that reports color 40, indicating that it did not accept the requested TrueColor background, and with a terminal that returns an unsuccessful request response because it does not understand DECRQSS.

The interaction has practical boundaries. The response must arrive within a few centiseconds, and a failure to respond can be treated as probable lack of support. This approach is therefore appropriate only where the application has a terminal input channel, can distinguish the response from unrelated input, and can avoid sending control sequences to a noninteractive stream. The README does not claim that this query works in every terminal or application environment.

A short tutorial for testing downloaded color scripts safely

termstandard/colors does not document installation because it is a reference repository rather than a package with a documented setup process. The README directs readers to scripts hosted in external repositories and gists. Its example creates a sandbox directory, downloads four scripts, and recommends inspecting them before execution. Use this only when those external files are relevant to the terminal test being performed.

The first block creates a temporary directory and changes into it. The README uses tmp$$ as the directory name, which relies on the shell's current process identifier.

bash
mkdir tmp$$
cd tmp$$

The next block downloads `color-spaces.pl`, `colors.py`, `24-bit-color.sh`, and `img.sh` from the URLs printed in the repository documentation.

bash
wget https://github.com/robertknight/konsole/raw/master/tests/color-spaces.pl \
     https://gist.github.com/lilydjwg/fdeaf79e921c2f413f44b6f613f6ad53/raw/94d8b2be62657e96488038b0e547e3009ed87d40/colors.py \
     https://github.com/JohnMorales/dotfiles/raw/master/colors/24-bit-color.sh \
     https://gitlab.gnome.org/GNOME/vte/-/raw/master/perf/img.sh

Before running the downloaded files, the README instructs the reader to inspect them with an editor.

bash
$EDITOR *

Only after deciding that the scripts are trustworthy does the documented example run them according to their file types.

bash
perl color-spaces.pl
python colors.py
bash 24-bit-color.sh
bash img.sh

The repository does not document dependency versions, output formats, rollback steps, or supported operating systems for these external scripts.

Maintenance, licensing, and the limits of this reference

The repository is not archived, and the last push was on 2026-08-07. The repository has no GitHub releases. That information describes the repository state, but the README does not promise a release cadence, compatibility guarantee, or support policy. Users should not infer that every referenced external script or terminal behavior is updated in step with the repository.

The repository is licensed under the Unlicense. The README contains explanatory text and code examples, while the repository's top-level entries are LICENSE and README.md. The Unlicense is relevant when copying or redistributing material, but the README does not give legal guidance about how the license interacts with terminal standards, external scripts, trademarks, or other repositories. Those questions require separate review.

Compared with a terminal emulator's own test suite, termstandard/colors is narrower. It explains color representations and offers detection approaches, but it does not enumerate every terminal implementation or guarantee that a feature behaves identically across emulators. Compared with a standard such as ncurses terminfo, it discusses that capability without replacing terminal capability databases. The appropriate use is as a decision aid during implementation, followed by verification against the actual target terminals.

Editorial conclusion

Adopt termstandard/colors as a reference when implementing terminal color support, especially for detection across sudo, SSH, and older terminals. Do not treat it as a complete compatibility database or a replacement for testing in the target environment. Verify first whether your terminal sets COLORTERM, whether it accepts colon-delimited sequences, and whether an interactive response can be read without blocking the application.

Frequently asked questions

How does termstandard/colors detect TrueColor support?

The README documents two approaches: check whether COLORTERM contains truecolor or 24bit, or query the terminal interactively by setting an RGB color and requesting the active color. It notes that the environment variable may not survive sudo or SSH, while the query requires an interactive response channel.

Does termstandard/colors support 24-bit RGB colors?

Yes. The README describes TrueColor as a 256x256x256 RGB cube and provides a shell test using RGB values 255, 102, and 0. It also explains that a 256-color palette can display RGB colors, but only 256 distinct colors simultaneously.

Does termstandard/colors have installation instructions?

No package installation instructions are documented. The repository is a reference with README.md and LICENSE, and the README points to external color-test scripts. It does show how to download and inspect those scripts in a temporary directory.

Which terminals are mentioned as supporting TrueColor?

The README specifically mentions VTE, Konsole, and iTerm2 as terminals that can advertise support through COLORTERM=truecolor. It does not claim that every terminal behaves this way, and it notes that Konsole and iTerm2 support was relatively new in the referenced documentation and depended on compile-time settings.

Official sources

  1. Issues
  2. License: Unlicense
  3. README
  4. termstandard/colors on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/termstandard-colors.svg)](https://hysenlabs.com/projects/termstandard-colors)

Was this useful?