Description
Format explicit bounded numeric SGR parameters as a seven-bit CSI token; empty parameter list emits the standard empty/reset SGR, no terminal effects.
Terminal escape sequences can encode cursor commands, text styles and other controls inside ordinary text. SGR changes selected graphic attributes; CSI and OSC tokens have different framing. These tools operate on explicit strings and records, with a deliberately limited parser or style model rather than an emulated screen.1
Format explicit bounded numeric SGR parameters as a seven-bit CSI token; empty parameter list emits the standard empty/reset SGR, no terminal effects.
When to use this tool
Use this tool to format explicit bounded numeric SGR parameters as a seven-bit CSI token; empty parameter list emits the standard empty/reset SGR, no terminal effects.
How to use the tool and how it works
- Enter parameters using the field definitions below.
- Run the operation. Correct input errors before interpreting an output.
- Read result.token. Use the ordering, boundary rules and absence conditions described below.
Validate integer parameters from 0 through 255, join them with semicolons, and wrap the result in an SGR escape token.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| parameters | Explicit numeric SGR parameters, in sequence order. | Dense list of at most 128 finite numbers; integer/shape constraints above also apply. |
| Output field | Interpretation |
|---|---|
| result | Object containing the named fields below. |
| result.token | Formatted terminal control string; JSON escaping shows its control characters. |
{
"input": {
"parameters": [
1,
31
]
},
"output": {
"result": {
"token": "\u001b[1;31m"
}
}
} Limitations and assumptions
- An empty list formats the empty-parameter SGR reset token; no terminal is contacted.
- Source spans use zero-based UTF-16 offsets with exclusive ends; byte totals, where returned, use UTF-8. Escape tokens are represented as JSON escapes in the example and are not executed by this description.
- Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.
Alternative or Complementary methods
Use token inspection for source offsets and style replay for the supported attributes. A real terminal emulator is needed to determine screen contents, terminal-specific rendering or device behavior.
References
-
ECMA-48: Control Functions for Coded Character Sets — Ecma International
-
Tool behavior and example: Terminal SGR Parameter List Formatter — tool.io
Similar or alternative tools
- Terminal SGR Parameter List Parser
Parse one seven-bit ESC[ semicolon-only SGR token with empty parameters defaulting to zero; no colon subparameters, C1 CSI or unsupported numeric ranges.
- Terminal CSI Cursor Move Formatter
Format a supported relative CSI cursor movement token with positive explicit count; directions are up/down/right/left only, no terminal execution.