Skip to main content
ansicode

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

Foreground colour
Background colour
SGR attributes
Trailing reset (\e[0m)

Live preview

Hello, world!

Generated CSI parameters

CSI 1;31 m

Output as

Snippet

Literal (\e)
\e[1;31mHello, world!\e[0m

All 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.

30 / 30
All 30 language string-literal forms
LanguageLiteral formOne-liner to print itCopy
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: