diff options
Diffstat (limited to 'src/highlight.zig')
| -rw-r--r-- | src/highlight.zig | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/highlight.zig b/src/highlight.zig new file mode 100644 index 0000000..b0f4cfd --- /dev/null +++ b/src/highlight.zig | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | pub const Highlight = enum { | ||
| 2 | none, | ||
| 3 | normal, | ||
| 4 | // Syntax highlighting | ||
| 5 | comment, | ||
| 6 | comment_ml, | ||
| 7 | keyword1, | ||
| 8 | keyword2, | ||
| 9 | number, | ||
| 10 | string, | ||
| 11 | // Other "faces" | ||
| 12 | line_no, | ||
| 13 | match, | ||
| 14 | overlong_line, | ||
| 15 | |||
| 16 | pub fn asString(hl: Highlight) []const u8 { | ||
| 17 | return switch (hl) { | ||
| 18 | .none => "\x1b[m", | ||
| 19 | |||
| 20 | .normal => "\x1b[39m", | ||
| 21 | |||
| 22 | .comment => "\x1b[36m", | ||
| 23 | .comment_ml => "\x1b[36m", | ||
| 24 | .keyword1 => "\x1b[33m", | ||
| 25 | .keyword2 => "\x1b[32m", | ||
| 26 | .number => "\x1b[31m", | ||
| 27 | .string => "\x1b[35m", | ||
| 28 | |||
| 29 | .line_no => "\x1b[0;90m", | ||
| 30 | .match => "\x1b[34m", | ||
| 31 | .overlong_line => "\x1b[91m", | ||
| 32 | }; | ||
| 33 | } | ||
| 34 | }; | ||