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// in-band window size reports
24pub const in_band_resize_set = "\x1b[?2048h";
25pub const in_band_resize_reset = "\x1b[?2048l";
26
27// sync
28pub const sync_set = "\x1b[?2026h";
29pub const sync_reset = "\x1b[?2026l";
30
31// unicode
32pub const unicode_set = "\x1b[?2027h";
33pub const unicode_reset = "\x1b[?2027l";
34
35// bracketed paste
36pub const bp_set = "\x1b[?2004h";
37pub const bp_reset = "\x1b[?2004l";
38
39// color scheme updates
40pub const color_scheme_request = "\x1b[?996n";
41pub const color_scheme_set = "\x1b[?2031h";
42pub const color_scheme_reset = "\x1b[?2031l";
43
44// Key encoding
45pub const csi_u_push = "\x1b[>{d}u";
46pub const csi_u_pop = "\x1b[<u";
47
48// Cursor
49pub const home = "\x1b[H";
50pub const cup = "\x1b[{d};{d}H";
51pub const hide_cursor = "\x1b[?25l";
52pub const show_cursor = "\x1b[?25h";
53pub const cursor_shape = "\x1b[{d} q";
54pub const ri = "\x1bM";
55pub const ind = "\n";
56pub const cuf = "\x1b[{d}C";
57pub const cub = "\x1b[{d}D";
58
59// Erase
60pub const erase_below_cursor = "\x1b[J";
61
62// alt screen
63pub const smcup = "\x1b[?1049h";
64pub const rmcup = "\x1b[?1049l";
65
66// sgr reset all
67pub const sgr_reset = "\x1b[m";
68
69// colors
70pub const fg_base = "\x1b[3{d}m";
71pub const fg_bright = "\x1b[9{d}m";
72pub const bg_base = "\x1b[4{d}m";
73pub const bg_bright = "\x1b[10{d}m";
74
75pub const fg_reset = "\x1b[39m";
76pub const bg_reset = "\x1b[49m";
77pub const ul_reset = "\x1b[59m";
78pub const fg_indexed = "\x1b[38:5:{d}m";
79pub const bg_indexed = "\x1b[48:5:{d}m";
80pub const ul_indexed = "\x1b[58:5:{d}m";
81pub const fg_rgb = "\x1b[38:2:{d}:{d}:{d}m";
82pub const bg_rgb = "\x1b[48:2:{d}:{d}:{d}m";
83pub const ul_rgb = "\x1b[58:2:{d}:{d}:{d}m";
84pub const fg_indexed_legacy = "\x1b[38;5;{d}m";
85pub const bg_indexed_legacy = "\x1b[48;5;{d}m";
86pub const ul_indexed_legacy = "\x1b[58;5;{d}m";
87pub const fg_rgb_legacy = "\x1b[38;2;{d};{d};{d}m";
88pub const bg_rgb_legacy = "\x1b[48;2;{d};{d};{d}m";
89pub const ul_rgb_legacy = "\x1b[58;2;{d};{d};{d}m";
90
91// Underlines
92pub const ul_off = "\x1b[24m"; // NOTE: this could be \x1b[4:0m but is not as widely supported
93pub const ul_single = "\x1b[4m";
94pub const ul_double = "\x1b[4:2m";
95pub const ul_curly = "\x1b[4:3m";
96pub const ul_dotted = "\x1b[4:4m";
97pub const ul_dashed = "\x1b[4:5m";
98
99// Attributes
100pub const bold_set = "\x1b[1m";
101pub const dim_set = "\x1b[2m";
102pub const italic_set = "\x1b[3m";
103pub const blink_set = "\x1b[5m";
104pub const reverse_set = "\x1b[7m";
105pub const invisible_set = "\x1b[8m";
106pub const strikethrough_set = "\x1b[9m";
107pub const bold_dim_reset = "\x1b[22m";
108pub const italic_reset = "\x1b[23m";
109pub const blink_reset = "\x1b[25m";
110pub const reverse_reset = "\x1b[27m";
111pub const invisible_reset = "\x1b[28m";
112pub const strikethrough_reset = "\x1b[29m";
113
114// OSC sequences
115pub const osc2_set_title = "\x1b]2;{s}\x1b\\";
116pub const osc7 = "\x1b]7;{;+/}\x1b\\";
117pub const osc8 = "\x1b]8;{s};{s}\x1b\\";
118pub const osc8_clear = "\x1b]8;;\x1b\\";
119pub const osc9_notify = "\x1b]9;{s}\x1b\\";
120pub const osc777_notify = "\x1b]777;notify;{s};{s}\x1b\\";
121pub const osc22_mouse_shape = "\x1b]22;{s}\x1b\\";
122pub const osc52_clipboard_copy = "\x1b]52;c;{s}\x1b\\";
123pub const osc52_clipboard_request = "\x1b]52;c;?\x1b\\";
124
125// Kitty graphics
126pub const kitty_graphics_clear = "\x1b_Ga=d\x1b\\";
127pub const kitty_graphics_preamble = "\x1b_Ga=p,i={d}";
128pub const kitty_graphics_closing = ",C=1\x1b\\";
129
130// Color control sequences
131pub const osc4_query = "\x1b]4;{d};?\x1b\\"; // color index {d}
132pub const osc4_reset = "\x1b]104\x1b\\"; // this resets _all_ color indexes
133pub const osc10_query = "\x1b]10;?\x1b\\"; // fg
134pub const osc10_set = "\x1b]10;rgb:{x:0>2}{x:0>2}/{x:0>2}{x:0>2}/{x:0>2}{x:0>2}\x1b\\"; // set default terminal fg
135pub const osc10_reset = "\x1b]110\x1b\\"; // reset fg to terminal default
136pub const osc11_query = "\x1b]11;?\x1b\\"; // bg
137pub const osc11_set = "\x1b]11;rgb:{x:0>2}{x:0>2}/{x:0>2}{x:0>2}/{x:0>2}{x:0>2}\x1b\\"; // set default terminal bg
138pub const osc11_reset = "\x1b]111\x1b\\"; // reset bg to terminal default
139pub const osc12_query = "\x1b]12;?\x1b\\"; // cursor color
140pub const osc12_reset = "\x1b]112\x1b\\"; // reset cursor to terminal default