summaryrefslogtreecommitdiff
path: root/src/Art.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 23:14:39 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commita7a446e0f32cb9daaa06689c91ef7de01bfc968c (patch)
treec51501cb55862f0b527606292e61d04e0e78edaf /src/Art.zig
parentb2163c0a53a6276bc8e1211e9a7c9584bb1ccb2e (diff)
downloadpardes-a7a446e0f32cb9daaa06689c91ef7de01bfc968c.tar.gz
pardes-a7a446e0f32cb9daaa06689c91ef7de01bfc968c.zip
colors: the 256-colour palette is pardes's own, colors.xterm (the sixteen named colours Art.zig kept, xterm's 6x6x6 cube and 24-grey ramp, at comptime), so Art.zig and gui.zig stop importing ghostty-vt: Art's Petscii takes its first sixteen and drops its comptime check against the emulator, gui.zig's palColor goes and its two .index cells read the table; terminal.zig's test holds all 256 entries to ghostty-vt's color.default; the changelog says so
Diffstat (limited to 'src/Art.zig')
-rw-r--r--src/Art.zig32
1 files changed, 2 insertions, 30 deletions
diff --git a/src/Art.zig b/src/Art.zig
index 6cc33e2e..2e2941c6 100644
--- a/src/Art.zig
+++ b/src/Art.zig
@@ -6,7 +6,7 @@
//! the same on every client. One of these a frontend keeps the art of the
//! pictures it shows, while it shows them.
const std = @import("std");
-const ghostty_vt = @import("ghostty-vt");
+const colors = @import("colors.zig");
const pardes = @import("pardes.zig");
const Art = @This();
@@ -76,7 +76,7 @@ fn gridOf(art: *Art, gpa: std.mem.Allocator, place: Placement, cell_h: u32) ?Gri
}
const colours = switch (place.art.palette) {
.commodore => commodore,
- .terminal => terminal_palette,
+ .terminal => colors.xterm[0..16].*,
};
const grid = (if (place.at == null)
fitted(gpa, place.raster, place.src, place.dst.w, place.dst.h, colours, place.art.ascii)
@@ -466,34 +466,6 @@ 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));