summaryrefslogtreecommitdiff
path: root/src/Art.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Art.zig')
-rw-r--r--src/Art.zig55
1 files changed, 28 insertions, 27 deletions
diff --git a/src/Art.zig b/src/Art.zig
index 6a938f68..6cc33e2e 100644
--- a/src/Art.zig
+++ b/src/Art.zig
@@ -466,6 +466,34 @@ fn renderRect(gpa: std.mem.Allocator, raster: Raster, src: RectPx, cols: usize,
return .{ .cells = cells, .cols = cols, .rows = rows };
}
+pub const terminal_palette = [16][3]u8{
+ .{ 0x1D, 0x1F, 0x21 }, // black
+ .{ 0xCC, 0x66, 0x66 }, // red
+ .{ 0xB5, 0xBD, 0x68 }, // green
+ .{ 0xF0, 0xC6, 0x74 }, // yellow
+ .{ 0x81, 0xA2, 0xBE }, // blue
+ .{ 0xB2, 0x94, 0xBB }, // magenta
+ .{ 0x8A, 0xBE, 0xB7 }, // cyan
+ .{ 0xC5, 0xC8, 0xC6 }, // white
+ .{ 0x66, 0x66, 0x66 }, // bright black
+ .{ 0xD5, 0x4E, 0x53 }, // bright red
+ .{ 0xB9, 0xCA, 0x4A }, // bright green
+ .{ 0xE7, 0xC5, 0x47 }, // bright yellow
+ .{ 0x7A, 0xA6, 0xDA }, // bright blue
+ .{ 0xC3, 0x97, 0xD8 }, // bright magenta
+ .{ 0x70, 0xC0, 0xB1 }, // bright cyan
+ .{ 0xEA, 0xEA, 0xEA }, // bright white
+};
+
+comptime {
+ for (terminal_palette, 0..) |rgb, i| {
+ const c = ghostty_vt.color.default[i];
+ if (rgb[0] != c.r or rgb[1] != c.g or rgb[2] != c.b) @compileError(
+ "terminal palette differs from the emulator",
+ );
+ }
+}
+
test "sextant codepoints: blocks + endpoints" {
try std.testing.expectEqual(@as(u21, ' '), sextantCp(0));
try std.testing.expectEqual(@as(u21, 0x2588), sextantCp(63));
@@ -543,33 +571,6 @@ test "a tiny image fitted into cells makes a grid within bounds" {
try std.testing.expect(g.rows >= 1 and g.rows <= 10);
try std.testing.expectEqual(g.cols * g.rows, g.cells.len);
}
-pub const terminal_palette = [16][3]u8{
- .{ 0x1D, 0x1F, 0x21 }, // black
- .{ 0xCC, 0x66, 0x66 }, // red
- .{ 0xB5, 0xBD, 0x68 }, // green
- .{ 0xF0, 0xC6, 0x74 }, // yellow
- .{ 0x81, 0xA2, 0xBE }, // blue
- .{ 0xB2, 0x94, 0xBB }, // magenta
- .{ 0x8A, 0xBE, 0xB7 }, // cyan
- .{ 0xC5, 0xC8, 0xC6 }, // white
- .{ 0x66, 0x66, 0x66 }, // bright black
- .{ 0xD5, 0x4E, 0x53 }, // bright red
- .{ 0xB9, 0xCA, 0x4A }, // bright green
- .{ 0xE7, 0xC5, 0x47 }, // bright yellow
- .{ 0x7A, 0xA6, 0xDA }, // bright blue
- .{ 0xC3, 0x97, 0xD8 }, // bright magenta
- .{ 0x70, 0xC0, 0xB1 }, // bright cyan
- .{ 0xEA, 0xEA, 0xEA }, // bright white
-};
-
-comptime {
- for (terminal_palette, 0..) |rgb, i| {
- const c = ghostty_vt.color.default[i];
- if (rgb[0] != c.r or rgb[1] != c.g or rgb[2] != c.b) @compileError(
- "terminal palette differs from the emulator",
- );
- }
-}
test "a frontend draws a placement as glyph art where it shows no pixels, or where its pane asks, and else leaves the frame be" {
const gpa = std.testing.allocator;