Add some format methods

This commit is contained in:
2026-01-05 23:57:17 +01:00
parent e019470687
commit a17a39a9a4
9 changed files with 48 additions and 0 deletions

View File

@@ -66,6 +66,10 @@ pub const Color = extern struct {
pub inline fn asArray(self: Color) Array {
return @bitCast(self);
}
pub fn format(self: Color, w: *std.io.Writer) !void {
try w.print("#{X:0>2}{X:0>2}{X:0>2}{X:0>2}", .{ self.r, self.g, self.b, self.a });
}
};
test "l" {