| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //! object representing a single color in the sRGB colorspace with channel values from 0-255 |
| 2 | 2 | |
| 3 | 3 | const std = @import("std"); |
| 4 | const extras = @import("extras"); |
| 4 | 5 | const Self = @This(); |
| 5 | 6 | const color = @import("./mod.zig"); |
| 6 | 7 | const _x = @import("./_x.zig"); |
| ... | ... | @@ -27,9 +28,9 @@ pub fn initRGB(r: u8, g: u8, b: u8) Self { |
| 27 | 28 | pub fn parseHexConst(comptime input: *const [7:0]u8) Self { |
| 28 | 29 | comptime std.debug.assert(input[0] == '#'); |
| 29 | 30 | return comptime initRGB( |
| 30 | | std.fmt.parseInt(u8, input[1..3], 16) catch unreachable, |
| 31 | | std.fmt.parseInt(u8, input[3..5], 16) catch unreachable, |
| 32 | | std.fmt.parseInt(u8, input[5..7], 16) catch unreachable, |
| 31 | extras.parseDigits(u8, input[1..3], 16) catch unreachable, |
| 32 | extras.parseDigits(u8, input[3..5], 16) catch unreachable, |
| 33 | extras.parseDigits(u8, input[5..7], 16) catch unreachable, |
| 33 | 34 | ); |
| 34 | 35 | } |
| 35 | 36 | |
| ... | ... | @@ -37,9 +38,9 @@ pub fn parseHex(input: []const u8) Self { |
| 37 | 38 | std.debug.assert(input.len == 7); |
| 38 | 39 | std.debug.assert(input[0] == '#'); |
| 39 | 40 | return initRGB( |
| 40 | | std.fmt.parseInt(u8, input[1..3], 16) catch unreachable, |
| 41 | | std.fmt.parseInt(u8, input[3..5], 16) catch unreachable, |
| 42 | | std.fmt.parseInt(u8, input[5..7], 16) catch unreachable, |
| 41 | extras.parseDigits(u8, input[1..3], 16) catch unreachable, |
| 42 | extras.parseDigits(u8, input[3..5], 16) catch unreachable, |
| 43 | extras.parseDigits(u8, input[5..7], 16) catch unreachable, |
| 43 | 44 | ); |
| 44 | 45 | } |
| 45 | 46 | |