a modern tui library written in zig
at v0.1.0 60 lines 1.4 kB view raw
1const Image = @import("Image.zig"); 2 3pub const Cell = struct { 4 char: Character = .{}, 5 style: Style = .{}, 6 link: Hyperlink = .{}, 7 image: ?Image.Placement = null, 8}; 9 10/// Segment is a contiguous run of text that has a constant style 11pub const Segment = struct { 12 text: []const u8, 13 style: Style = .{}, 14 link: Hyperlink = .{}, 15}; 16 17pub const Character = struct { 18 grapheme: []const u8 = " ", 19 /// width should only be provided when the application is sure the terminal 20 /// will meeasure the same width. This can be ensure by using the gwidth method 21 /// included in libvaxis. If width is 0, libvaxis will measure the glyph at 22 /// render time 23 width: usize = 1, 24}; 25 26pub const Hyperlink = struct { 27 uri: []const u8 = "", 28 /// ie "id=app-1234" 29 params: []const u8 = "", 30}; 31 32pub const Style = struct { 33 pub const Underline = enum { 34 off, 35 single, 36 double, 37 curly, 38 dotted, 39 dashed, 40 }; 41 42 fg: Color = .default, 43 bg: Color = .default, 44 ul: Color = .default, 45 ul_style: Underline = .off, 46 47 bold: bool = false, 48 dim: bool = false, 49 italic: bool = false, 50 blink: bool = false, 51 reverse: bool = false, 52 invisible: bool = false, 53 strikethrough: bool = false, 54}; 55 56pub const Color = union(enum) { 57 default, 58 index: u8, 59 rgb: [3]u8, 60};