a modern tui library written in zig
1// Queries
2pub const primary_device_attrs = "\x1b[c";
3pub const tertiary_device_attrs = "\x1b[=c";
4pub const device_status_report = "\x1b[5n";
5pub const xtversion = "\x1b[>0q";
6pub const decrqm_focus = "\x1b[?1004$p";
7pub const decrqm_sgr_pixels = "\x1b[?1016$p";
8pub const decrqm_sync = "\x1b[?2026$p";
9pub const decrqm_unicode = "\x1b[?2027$p";
10pub const decrqm_color_scheme = "\x1b[?2031$p";
11pub const csi_u_query = "\x1b[?u";
12pub const kitty_graphics_query = "\x1b_Gi=1,a=q\x1b\\";
13pub const sixel_geometry_query = "\x1b[?2;1;0S";
14
15// mouse. We try for button motion and any motion. terminals will enable the
16// last one we tried (any motion). This was added because zellij doesn't
17// support any motion currently
18// See: https://github.com/zellij-org/zellij/issues/1679
19pub const mouse_set = "\x1b[?1002;1003;1004;1006h";
20pub const mouse_set_pixels = "\x1b[?1002;1003;1004;1016h";
21pub const mouse_reset = "\x1b[?1002;1003;1004;1006;1016l";
22
23// sync
24pub const sync_set = "\x1b[?2026h";
25pub const sync_reset = "\x1b[?2026l";
26
27// unicode
28pub const unicode_set = "\x1b[?2027h";
29pub const unicode_reset = "\x1b[?2027l";
30
31// bracketed paste
32pub const bp_set = "\x1b[?2004h";
33pub const bp_reset = "\x1b[?2004l";
34
35// color scheme updates
36pub const color_scheme_request = "\x1b[?996n";
37pub const color_scheme_set = "\x1b[?2031h";
38pub const color_scheme_reset = "\x1b[?2031l";
39
40// Key encoding
41pub const csi_u_push = "\x1b[>{d}u";
42pub const csi_u_pop = "\x1b[<u";
43
44// Cursor
45pub const home = "\x1b[H";
46pub const cup = "\x1b[{d};{d}H";
47pub const hide_cursor = "\x1b[?25l";
48pub const show_cursor = "\x1b[?25h";
49pub const cursor_shape = "\x1b[{d} q";
50pub const ri = "\x1bM";
51pub const ind = "\n";
52pub const cuf = "\x1b[{d}C";
53pub const cub = "\x1b[{d}D";
54
55// Erase
56pub const erase_below_cursor = "\x1b[J";
57
58// alt screen
59pub const smcup = "\x1b[?1049h";
60pub const rmcup = "\x1b[?1049l";
61
62// sgr reset all
63pub const sgr_reset = "\x1b[m";
64
65// colors
66pub const fg_base = "\x1b[3{d}m";
67pub const fg_bright = "\x1b[9{d}m";
68pub const bg_base = "\x1b[4{d}m";
69pub const bg_bright = "\x1b[10{d}m";
70
71pub const fg_reset = "\x1b[39m";
72pub const bg_reset = "\x1b[49m";
73pub const ul_reset = "\x1b[59m";
74pub const fg_indexed = "\x1b[38:5:{d}m";
75pub const bg_indexed = "\x1b[48:5:{d}m";
76pub const ul_indexed = "\x1b[58:5:{d}m";
77pub const fg_rgb = "\x1b[38:2:{d}:{d}:{d}m";
78pub const bg_rgb = "\x1b[48:2:{d}:{d}:{d}m";
79pub const ul_rgb = "\x1b[58:2:{d}:{d}:{d}m";
80pub const fg_indexed_legacy = "\x1b[38;5;{d}m";
81pub const bg_indexed_legacy = "\x1b[48;5;{d}m";
82pub const ul_indexed_legacy = "\x1b[58;5;{d}m";
83pub const fg_rgb_legacy = "\x1b[38;2;{d};{d};{d}m";
84pub const bg_rgb_legacy = "\x1b[48;2;{d};{d};{d}m";
85pub const ul_rgb_legacy = "\x1b[58;2;{d};{d};{d}m";
86
87// Underlines
88pub const ul_off = "\x1b[24m"; // NOTE: this could be \x1b[4:0m but is not as widely supported
89pub const ul_single = "\x1b[4m";
90pub const ul_double = "\x1b[4:2m";
91pub const ul_curly = "\x1b[4:3m";
92pub const ul_dotted = "\x1b[4:4m";
93pub const ul_dashed = "\x1b[4:5m";
94
95// Attributes
96pub const bold_set = "\x1b[1m";
97pub const dim_set = "\x1b[2m";
98pub const italic_set = "\x1b[3m";
99pub const blink_set = "\x1b[5m";
100pub const reverse_set = "\x1b[7m";
101pub const invisible_set = "\x1b[8m";
102pub const strikethrough_set = "\x1b[9m";
103pub const bold_dim_reset = "\x1b[22m";
104pub const italic_reset = "\x1b[23m";
105pub const blink_reset = "\x1b[25m";
106pub const reverse_reset = "\x1b[27m";
107pub const invisible_reset = "\x1b[28m";
108pub const strikethrough_reset = "\x1b[29m";
109
110// OSC sequences
111pub const osc2_set_title = "\x1b]2;{s}\x1b\\";
112pub const osc8 = "\x1b]8;{s};{s}\x1b\\";
113pub const osc8_clear = "\x1b]8;;\x1b\\";
114pub const osc9_notify = "\x1b]9;{s}\x1b\\";
115pub const osc777_notify = "\x1b]777;notify;{s};{s}\x1b\\";
116pub const osc22_mouse_shape = "\x1b]22;{s}\x1b\\";
117pub const osc52_clipboard_copy = "\x1b]52;c;{s}\x1b\\";
118pub const osc52_clipboard_request = "\x1b]52;c;?\x1b\\";
119
120// Kitty graphics
121pub const kitty_graphics_clear = "\x1b_Ga=d\x1b\\";
122pub const kitty_graphics_preamble = "\x1b_Ga=p,i={d}";
123pub const kitty_graphics_closing = ",C=1\x1b\\";
124
125// Color control sequences
126pub const osc4_query = "\x1b]4;{d};?\x1b\\"; // color index {d}
127pub const osc4_reset = "\x1b]104\x1b\\"; // this resets _all_ color indexes
128pub const osc10_query = "\x1b]10;?\x1b\\"; // fg
129pub const osc10_reset = "\x1b]110\x1b\\"; // reset fg to terminal default
130pub const osc11_query = "\x1b]11;?\x1b\\"; // bg
131pub const osc11_reset = "\x1b]111\x1b\\"; // reset bg to terminal default
132pub const osc12_query = "\x1b]12;?\x1b\\"; // cursor color
133pub const osc12_reset = "\x1b]112\x1b\\"; // reset cursor to terminal default