Document ANSI color code generation by recording the input choices, SGR parameters, escaped review form, raw-sequence destination, reset result, and color fallback.
ANSI color codes are the graphic-rendition parameters inside a terminal escape sequence, not a universal visual specification. A reproducible record therefore needs two layers: the exact code you generated and the environment in which you tested it. The ANSI Color Codes Generator supports the generation and inspection part of that record, but the destination application and terminal remain your responsibility.

What an ANSI color generation record should contain
A useful record lets another developer regenerate the same bytes, understand the intended effect, and repeat the test without guessing which parameter represented color, style, or reset. Store the choices and observations separately when possible, especially if the terminal theme later changes the displayed color.
| Artifact | What to document | Why it matters |
|---|---|---|
| Generation request | Sample text and the selected foreground, background, bold, or underline options | Shows the intended input and distinguishes required styling from optional styling. |
| SGR parameters | The exact semicolon-separated values shown by the generator | Provides a compact, reproducible description of the generated prefix. |
| Review representation | The visible escaped form, with the escape byte written as \x1b | Makes the control sequence readable without relying on terminal rendering. |
| Raw sequence | The actual ESC byte, SGR prefix, text, and appended reset | Allows exact reproduction in a trusted terminal-aware fixture or source string. |
| Test context | Application, terminal or emulator, output mode, and relevant theme | Explains why the same SGR values can produce different visible results. |
| Verification result | Observed formatting, reset behavior, and disable-color fallback | Turns a code sample into a tested and maintainable implementation note. |
Use a harmless, non-sensitive sample text in documentation. If the real text is confidential, document the structure with placeholders and keep the exact generated sequence in an appropriately controlled test artifact.
Document the ANSI color generation workflow
Write the workflow as a sequence of inputs, generated values, review actions, and tests rather than as a list of unexplained numbers.
- Define the destination. Identify the application, terminal or emulator, output path, and whether the output is interactive or redirected. Note whether the project already has a policy for color, such as honoring a no-color convention or exposing a command-line option that disables styling.
- Enter the sample and styling choices. In the ANSI Color Codes Generator, enter the text and select an optional foreground color, background color, bold, or underline. The current interface does not expose every theoretical SGR style, so document only the controls actually used.
- Generate and inspect both representations. Generate the sequence, then inspect the visibly escaped representation and the listed SGR parameters. Confirm that the selected foreground, background, and styles correspond to the intended values before copying anything.
- Write the exact values into the record. Save the parameter list and the readable escaped form. Preserve the parameter order shown by the tool so the documented output matches the exact generated bytes. Use the visible form in Markdown, HTML, issue templates, and ordinary documentation.
- Copy the raw sequence only into a trusted terminal-aware context. The Copy control copies the actual escape byte, SGR parameters, text, and reset. Use it only for a suitable source string, terminal-aware tool, controlled fixture, or debugging workflow where control characters are expected and understood.
- Test the result and record the outcome. Run the sequence in the actual application, confirm that formatting appears as intended, and check that later output does not inherit the style. Record the result, known terminal differences, and the route users can use to disable color.
Keep the workflow’s scope clear: the generator builds the sequence locally in the browser and does not execute it in a shell. Verification occurs only after you paste or embed the raw output in a suitable destination.
Make the sequence readable in the documentation
Select Graphic Rendition, abbreviated SGR, is defined by ECMA-48. The generated structure begins with an escape byte and opening bracket, continues with semicolon-separated decimal SGR parameters, and ends the control prefix with m. The selected text follows that prefix, and the generator appends ESC[0m to reset graphic rendition.
For one complete example, bright red foreground, blue background, bold, and underline use the parameters 1;4;91;44. The corresponding visible review representation is \x1b[1;4;91;44mSTATUS\x1b[0m. Here, 1 selects bold, 4 selects underline, 91 selects the bright red foreground slot, and 44 selects the blue background slot. The final 0 resets the rendition after the text.
Do not confuse the visible review string with the copied raw sequence. The visible representation spells the escape byte as the four characters \x1b. The raw clipboard content contains the actual ESC control byte. That distinction matters when a log, source file, or issue needs readable text rather than invisible terminal control data.
For a compact reference to SGR grammar and safe handling, see ANSI Escape Codes: SGR Parameter Format and Safe Handling.
Record color and style values accurately
Document the exact SGR values while labeling color names as palette slots. The names identify standard terminal positions, not guaranteed RGB values. Themes, profiles, accessibility settings, multiplexers, remote environments, and applications can remap those slots.
| Use | SGR values | Documentation note |
|---|---|---|
| Base foreground | 30 through 37 | Black, red, green, yellow, blue, magenta, cyan, and white, in that order. |
| Base background | 40 through 47 | Uses the same color-slot order as the base foreground range. |
| Common bright foreground | 90 through 97 | Common xterm-compatible extensions; these do not guarantee a fixed RGB shade. |
| Common bright background | 100 through 107 | Common xterm-compatible extensions that select bright palette positions. |
| Bold | 1 | May increase intensity instead of changing the font weight. |
| Underline | 4 | Underline shape and color can vary between consumers. |
| Reset | 0 | Ends the active graphic rendition when the destination interprets SGR correctly. |
The generator rejects unsupported style and color numbers instead of treating them as valid selections. The current interface exposes bold and underline, so do not document other style choices as available controls. Also avoid describing bold as guaranteed to produce heavier text: some terminals use it to access a bright palette, while others treat it as increased intensity.
Verify the destination and reset behavior
The generator has no terminal emulator and cannot determine whether the destination supports ECMA-48, common xterm bright extensions, Windows virtual terminal processing, no-color conventions, or redirected noninteractive output. It also cannot predict the theme or settings used by another user. Record those conditions as assumptions and test the actual application that will consume the sequence.
- Check the intended output path. Interactive terminals may render SGR sequences, while redirected output, captured fixtures, or some application APIs may strip or ignore them.
- Check the active theme. Verify that the foreground and background slots remain distinguishable under the themes your users actually run.
- Check what follows the sequence. Confirm that ordinary output after the reset does not retain bold, underline, foreground, or background formatting.
- Check the fallback. Document a way to disable color and verify that the output remains readable when styling is turned off.
The appended reset is a useful guardrail, but it is not proof that every consumer interprets the stream identically. A clear documentation record states what was tested, on which system, and which behavior remained unverified.
Keep raw control bytes out of untrusted logs
Raw escape bytes are control data, not ordinary readable text. Pasting them into a terminal command line, log, issue, chat message, or source file may appear invisible or behave unexpectedly when the destination later displays or interprets the content. Untrusted control characters can hide text, forge visual lines, create misleading links, or disrupt terminal state.
Use the visibly escaped representation in documentation and reports. Before printing untrusted data to an interactive terminal, sanitize it, and provide a plain-text logging path that removes control sequences or visibly escapes them. The guide to handling ANSI sequences safely in logs expands on that separation.
All text, choices, generated bytes, search terms, and clipboard operations in the generator remain in the browser. Nothing is uploaded to a server or executed in a shell, but that processing guarantee does not make the copied raw bytes safe for every destination.
Use a compact documentation record
A reusable note can combine the essential evidence without turning every implementation detail into prose:
Record: Context: [application, terminal, and output mode]; Input: [sample text]; Options: [foreground, background, bold, underline]; SGR parameters: [exact values]; Review form: [visibly escaped sequence]; Destination: [trusted terminal-aware context]; Reset result: [observed behavior]; Disable-color result: [observed fallback]; Caveats: [theme, palette, or support limitations].
Keep the exact SGR parameters and visibly escaped representation together so a future maintainer can compare the intended request with the generated bytes. Store the raw sequence separately when exact reproduction is necessary, limit access to trusted fixtures, and update the record whenever the application’s output path, terminal support, or color policy changes.