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