authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 22:23:12 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 22:23:12 -07:00
log5ce109093331a903837e27e6786cc96d277e6404
treeb86f4114963b6c7b9dea1247a00d575af3a70358
parente7c110f1e082f3e68e25f454d5fd8fb41b8c794b
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

sRGB: switch format to nprint


1 files changed, 3 insertions(+), 14 deletions(-)

sRGB.zig+3-14
...@@ -48,24 +48,13 @@ pub fn eql(x: Self, y: Self) bool {...@@ -48,24 +48,13 @@ pub fn eql(x: Self, y: Self) bool {
48 return x.r == y.r and x.g == y.g and x.b == y.b and x.a == y.a;48 return x.r == y.r and x.g == y.g and x.b == y.b and x.a == y.a;
49}49}
5050
51pub fn format(x: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {51pub fn nprint(x: Self, writer: anytype) !void {
52 _ = fmt;
53 _ = options;
54 if (x.a < 255) {52 if (x.a < 255) {
55 @branchHint(.cold);53 @branchHint(.cold);
56 try writer.print("#{:0>2}{:0>2}{:0>2}{:0>2}", .{54 try writer.print("#{x:0>2}{x:0>2}{x:0>2}{x:0>2}", .{ x.r, x.g, x.b, x.a });
57 std.fmt.fmtSliceHexLower(&.{x.r}),
58 std.fmt.fmtSliceHexLower(&.{x.g}),
59 std.fmt.fmtSliceHexLower(&.{x.b}),
60 std.fmt.fmtSliceHexLower(&.{x.a}),
61 });
62 return;55 return;
63 }56 }
64 try writer.print("#{:0>2}{:0>2}{:0>2}", .{57 try writer.print("#{x:0>2}{x:0>2}{x:0>2}", .{ x.r, x.g, x.b });
65 std.fmt.fmtSliceHexLower(&.{x.r}),
66 std.fmt.fmtSliceHexLower(&.{x.g}),
67 std.fmt.fmtSliceHexLower(&.{x.b}),
68 });
69}58}
7059
71const M = _x.mixin(@This(), u8, .r, .g, .b);60const M = _x.mixin(@This(), u8, .r, .g, .b);