A pretty printer for zig
zig

clean up

altagos.dev 967a7ac2 f3bc70ac

verified
+4 -11
+1
build.zig
··· 21 21 }), 22 22 .name = "pretty-example", 23 23 }); 24 + b.installArtifact(example); 24 25 25 26 const run_example = b.addRunArtifact(example); 26 27 run_example.step.dependOn(b.getInstallStep());
+3 -11
pretty.zig
··· 38 38 color_true: Io.Terminal.Color = .bright_green, 39 39 color_false: Io.Terminal.Color = .bright_red, 40 40 41 - pub fn getColor(this: Theme, option: Colors) Io.Terminal.Color { 42 - return switch (option) { 43 - // .dim => this.color_dim, 44 - // .field => this.color_field, 45 - // .value => this.color_value, 46 - // .@"error" => this.color_error, 47 - // .type => this.color_type, 48 - // .null => this.color_null, 49 - // .true => this.color_true, 50 - // .false => this.color_false, 51 - inline else => |opt| @field(this, "color_" ++ @tagName(opt)), 41 + pub fn getColor(this: Theme, color: Colors) Io.Terminal.Color { 42 + return switch (color) { 43 + inline else => |col| @field(this, "color_" ++ @tagName(col)), 52 44 }; 53 45 } 54 46 };