summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gen_themes.zig15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/gen_themes.zig b/tools/gen_themes.zig
index 65e85d1c..be5fde2f 100644
--- a/tools/gen_themes.zig
+++ b/tools/gen_themes.zig
@@ -152,13 +152,14 @@ fn byName(_: void, a: Theme, b: Theme) bool {
fn emit(w: *std.Io.Writer, t: Theme) !void {
try w.writeAll("// Generated by tools/gen_themes.zig. Do not edit.\npub const theme = .{\n");
try w.print(" .name = \"{s}\",\n", .{t.name});
- inline for (@typeInfo(Theme).@"struct".fields) |f| {
- if (comptime std.mem.eql(u8, f.name, "name")) continue;
- if (comptime std.mem.eql(u8, f.name, "palette")) continue;
- try w.print(" .{s} = ", .{f.name});
- if (comptime @typeInfo(f.type) == .optional) {
- if (@field(t, f.name)) |c| try rgb(w, c) else try w.writeAll("null");
- } else try rgb(w, @field(t, f.name));
+ const info = @typeInfo(Theme).@"struct";
+ inline for (info.field_names, info.field_types) |name, T| {
+ if (comptime std.mem.eql(u8, name, "name")) continue;
+ if (comptime std.mem.eql(u8, name, "palette")) continue;
+ try w.print(" .{s} = ", .{name});
+ if (comptime @typeInfo(T) == .optional) {
+ if (@field(t, name)) |c| try rgb(w, c) else try w.writeAll("null");
+ } else try rgb(w, @field(t, name));
try w.writeAll(",\n");
}
if (t.palette) |p| {