2024-01-30 23:26:35 +01:00
|
|
|
const Image = @import("Image.zig");
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
pub const Cell = struct {
|
2024-01-19 18:02:32 +01:00
|
|
|
char: Character = .{},
|
2024-01-19 04:02:17 +01:00
|
|
|
style: Style = .{},
|
2024-01-25 02:04:12 +01:00
|
|
|
link: Hyperlink = .{},
|
2024-01-30 23:26:35 +01:00
|
|
|
image: ?Image.Placement = null,
|
2024-01-19 04:02:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Character = struct {
|
2024-01-19 18:02:32 +01:00
|
|
|
grapheme: []const u8 = " ",
|
2024-01-29 05:42:51 +01:00
|
|
|
/// width should only be provided when the application is sure the terminal
|
|
|
|
/// will meeasure the same width. This can be ensure by using the gwidth method
|
|
|
|
/// included in libvaxis. If width is 0, libvaxis will measure the glyph at
|
|
|
|
/// render time
|
2024-01-19 18:02:32 +01:00
|
|
|
width: usize = 1,
|
2024-01-19 04:02:17 +01:00
|
|
|
};
|
|
|
|
|
2024-01-25 02:04:12 +01:00
|
|
|
pub const Hyperlink = struct {
|
|
|
|
uri: []const u8 = "",
|
|
|
|
/// ie "id=app-1234"
|
|
|
|
params: []const u8 = "",
|
|
|
|
};
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
pub const Style = struct {
|
2024-01-19 06:17:57 +01:00
|
|
|
pub const Underline = enum {
|
|
|
|
off,
|
|
|
|
single,
|
|
|
|
double,
|
|
|
|
curly,
|
|
|
|
dotted,
|
|
|
|
dashed,
|
|
|
|
};
|
|
|
|
|
2024-01-19 04:02:17 +01:00
|
|
|
fg: Color = .default,
|
|
|
|
bg: Color = .default,
|
|
|
|
ul: Color = .default,
|
2024-01-19 06:17:57 +01:00
|
|
|
ul_style: Underline = .off,
|
2024-01-20 02:43:35 +01:00
|
|
|
|
|
|
|
bold: bool = false,
|
|
|
|
dim: bool = false,
|
|
|
|
italic: bool = false,
|
|
|
|
blink: bool = false,
|
|
|
|
reverse: bool = false,
|
|
|
|
invisible: bool = false,
|
|
|
|
strikethrough: bool = false,
|
2024-01-19 04:02:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
pub const Color = union(enum) {
|
|
|
|
default,
|
|
|
|
index: u8,
|
|
|
|
rgb: [3]u8,
|
|
|
|
};
|