Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn RGB(comptime hexspec : [7] const u8) error{NoHash}!Color
- {
- if(hexspec[0] != '#')
- return error.NoHash;
- return Color {
- .R = (try std.fmt.charToDigit(hexspec[1]) << 4) | try std.fmt.charToDigit(hexspec[2]),
- .G = (try std.fmt.charToDigit(hexspec[3]) << 4) | try std.fmt.charToDigit(hexspec[4]),
- .B = (try std.fmt.charToDigit(hexspec[5]) << 4) | try std.fmt.charToDigit(hexspec[6]),
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement