Escape builder — pick a color and style, copy the bytes
The reverse of the decoder: pick a foreground colour, a background colour, and any combination of SGR attributes, see the rendered text live, and copy the escape sequence in your preferred language string-literal form. Everything runs in your browser.
Builder controls
Live preview
Generated CSI parameters
CSI 1;31 mOutput as
Snippet
\e[1;31mHello, world!\e[0mAll 30 language string-literal forms
The same SGR byte sequence built above, expressed in the idiomatic string-literal syntax each language expects. Click a language name to jump to its dedicated /use/<lang> helper page with libraries and richer patterns. Every row stays live with the controls — change the foreground / background / style or text input above and the whole table re-renders.
| Language | Literal form | One-liner to print it | Copy |
|---|---|---|---|
| Bash | \e[1;31mHello, world!\e[0m | printf '\e[1;31mHello, world!\e[0m\n' | |
| C | \x1b[1;31mHello, world!\x1b[0m | #include <stdio.h>
int main(void){printf("\x1b[1;31mHello, world!\x1b[0m\n");} | |
| Clojure | \u001b[1;31mHello, world!\u001b[0m | (println "\u001b[1;31mHello, world!\u001b[0m") | |
| Crystal | \e[1;31mHello, world!\e[0m | puts "\e[1;31mHello, world!\e[0m" | |
| C# | \u001b[1;31mHello, world!\u001b[0m | Console.WriteLine("\u001b[1;31mHello, world!\u001b[0m"); | |
| Dart | \x1b[1;31mHello, world!\x1b[0m | print('\x1b[1;31mHello, world!\x1b[0m'); | |
| Elixir | \e[1;31mHello, world!\e[0m | IO.puts("\e[1;31mHello, world!\e[0m") | |
| Erlang | \e[1;31mHello, world!\e[0m | io:format("\e[1;31mHello, world!\e[0m~n"). | |
| F# | \u001b[1;31mHello, world!\u001b[0m | printfn "\u001b[1;31mHello, world!\u001b[0m" | |
| Go | \x1b[1;31mHello, world!\x1b[0m | package main
import "fmt"
func main(){fmt.Println("\x1b[1;31mHello, world!\x1b[0m")} | |
| Haskell | \ESC[1;31mHello, world!\ESC[0m | main = putStrLn "\ESC[1;31mHello, world!\ESC[0m" | |
| Java | \u001b[1;31mHello, world!\u001b[0m | System.out.println("\u001b[1;31mHello, world!\u001b[0m"); | |
| JavaScript | \x1b[1;31mHello, world!\x1b[0m | console.log("\x1b[1;31mHello, world!\x1b[0m"); | |
| Julia | \e[1;31mHello, world!\e[0m | println("\e[1;31mHello, world!\e[0m") | |
| Kotlin | \u001b[1;31mHello, world!\u001b[0m | println("\u001b[1;31mHello, world!\u001b[0m") | |
| Lua | \27[1;31mHello, world!\27[0m | print("\27[1;31mHello, world!\27[0m") | |
| Nim | \e[1;31mHello, world!\e[0m | echo "\e[1;31mHello, world!\e[0m" | |
| Node.js | \x1b[1;31mHello, world!\x1b[0m | process.stdout.write("\x1b[1;31mHello, world!\x1b[0m\n"); | |
| OCaml | \027[1;31mHello, world!\027[0m | print_endline "\027[1;31mHello, world!\027[0m" | |
| Perl | \e[1;31mHello, world!\e[0m | print "\e[1;31mHello, world!\e[0m\n"; | |
| PHP | \033[1;31mHello, world!\033[0m | echo "\033[1;31mHello, world!\033[0m\n"; | |
| PowerShell | `e[1;31mHello, world!`e[0m | Write-Host "`e[1;31mHello, world!`e[0m" | |
| Python | \x1b[1;31mHello, world!\x1b[0m | print("\x1b[1;31mHello, world!\x1b[0m") | |
| R | \033[1;31mHello, world!\033[0m | cat("\033[1;31mHello, world!\033[0m\n") | |
| Ruby | \e[1;31mHello, world!\e[0m | puts "\e[1;31mHello, world!\e[0m" | |
| Rust | \x1b[1;31mHello, world!\x1b[0m | fn main(){println!("\x1b[1;31mHello, world!\x1b[0m");} | |
| Scala | \u001B[1;31mHello, world!\u001B[0m | println("\u001B[1;31mHello, world!\u001B[0m") | |
| Swift | \u{1B}[1;31mHello, world!\u{1B}[0m | print("\u{1B}[1;31mHello, world!\u{1B}[0m") | |
| TypeScript | \x1b[1;31mHello, world!\x1b[0m | console.log("\x1b[1;31mHello, world!\x1b[0m"); | |
| Zig | \x1b[1;31mHello, world!\x1b[0m | const std = @import("std");
pub fn main()!void{try std.io.getStdOut().writer().print("\x1b[1;31mHello, world!\x1b[0m\n", .{});} |
Notes
Output uses CSI (Control Sequence Introducer) + SGR (Select Graphic Rendition). The trailing reset (\e[0m) is recommended for one-off colouring so style does not bleed into subsequent output. Truecolour requires a terminal that advertises 24-bit colour (most modern terminals do — see the terminal matrix); 256-colour is universally supported in xterm-family terminals since the early 2000s. Bright colours (90–97 / 100–107) are aliases for 256-colour indices 8–15.
Related sequence pages
Every byte the builder emits is documented on its own page. Open these to see byte forms, spec citation, and per-terminal support:
- sgr-resetSGR 0 — Reset / Normal
- sgr-boldSGR 1 — Bold / Increased intensity
- sgr-italicSGR 3 — Italic
- sgr-underlineSGR 4 — Underline
- sgr-fg-basicSGR 30–37 — Foreground color (8 basic)
- sgr-bg-basicSGR 40–47 — Background color (8 basic)
- sgr-fg-brightSGR 90–97 — Bright foreground color
- sgr-bg-brightSGR 100–107 — Bright background color
- sgr-fg-256SGR 38;5;n — 256-color foreground
- sgr-bg-256SGR 48;5;n — 256-color background
- sgr-fg-truecolorSGR 38;2;R;G;B — 24-bit truecolor foreground
- sgr-bg-truecolorSGR 48;2;R;G;B — 24-bit truecolor background