Add some format methods
This commit is contained in:
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user